Real-time phase detection of frequency band

ABSTRACT

Techniques are described for real-time phase detection. For the phase detection, a signal is correlated with a frequency component of a frequency band whose phase is being detected, and the correlation includes predominantly decreasing weighting of past portions of the signals.

This application is a continuation of U.S. patent application Ser. No.16/057,417, filed Aug. 7, 2018, which is a continuation of U.S. patentapplication Ser. No. 14/945,139, filed Nov. 18, 2015, which claims thebenefit of U.S. Provisional Application No. 62/083,038, filed Nov. 21,2014, and U.S. Provisional Application No. 62/114,650, filed Feb. 11,2015. The entire content of each of these applications is incorporatedherein by reference.

GOVERNMENT INTEREST

This invention was made with government interest under prime awardnumber N66001-14-2-4-31, subaward number 56400 awarded by DARPA. Thegovernment has certain rights in the invention.

TECHNICAL FIELD

The disclosure relates to phase detection, and more particularly, tophase detection for use in controlling medical therapy.

BACKGROUND

Medical devices, such as electrical stimulators or therapeutic agentdelivery devices, may be used in different therapeutic applications,such as deep brain stimulation (DBS), spinal cord stimulation (SCS),pelvic stimulation, gastric stimulation, peripheral nerve stimulation,functional electrical stimulation or delivery of pharmaceutical agent,insulin, pain relieving agent or anti-inflammatory agent to a targettissue site within a patient. A medical device may be configured todeliver therapy to a patient to treat a variety of symptoms or patientconditions such as chronic pain, tremor, Parkinson's disease, othertypes of movement disorders, seizure disorders (e.g., epilepsy), urinaryor fecal incontinence, sexual dysfunction, obesity, mood disorders,gastroparesis or diabetes. In some therapy systems, an electricalstimulator delivers electrical therapy to a target tissue site within apatient with the aid of one or more electrodes, which may be deployed bymedical leads, on a housing of the electrical stimulator, or both. Inaddition to or instead of electrical stimulation therapy, a medicaldevice may deliver a therapeutic agent to a target tissue site within apatient with the aid of one or more fluid delivery elements, such as acatheter or a therapeutic agent eluting patch.

Some medical devices are configured to sense a patient parameter, suchas a bioelectrical brain signal. A sensed patient parameter may be usedfor various purposes, such as to control therapy delivery by a medicaldevice.

SUMMARY

The disclosure describes example techniques for determining a phase of afrequency band of a signal, such as a bioelectrical brain signal. Afrequency band phase detector may include one or more frequencycomponent phase detectors, where each frequency component refers to afrequency within the frequency band. Each of the frequency componentphase detectors may be configured to determine a phase of the frequencycomponent by weighting more recent samples of the signal more heavilythan later samples of the signal, as part of a correlation of the signalwith the frequency component. The frequency band phase detector mayaverage, and in some examples, generate a weighted average of, thedetermined phases by each of the one or more frequency component phasedetectors to determine the phase of the frequency band of the signal.

In one example, the disclosure describes a method comprising receiving,with a processor of a medical device, a first signal generated from asecond signal, correlating, with the processor of the medical device,the first signal with a frequency component of a frequency band of thesecond signal, wherein correlating includes predominantly decreasingweighting of past portions of the first signal, and whereinpredominantly decreasing weighting of past portions of the first signalcomprises predominantly weighting present and more recent portions ofthe first signal more heavily than earlier portions of the first signal,and wherein the frequency band includes one or more frequencycomponents, determining, with the processor of the medical device, aphase of the frequency component based on a filtered signal outputtedfrom the correlation, determining, with the processor of the medicaldevice, a phase of the frequency band based on the determined phase ofthe frequency component, and instructing, with the processor of themedical device, a therapy module to deliver therapy based on thedetermined phase of the frequency band.

In one example, the disclosure describes a medical device comprisingfrequency band phase detector comprising a frequency component phasedetector configured to receive a first signal generated from a secondsignal, correlate the first signal with a frequency component of afrequency band of the second signal, wherein to correlate, the frequencycomponent phase detector is configured to predominantly decreaseweighting of past portions of the first signal, wherein predominantlydecreasing weighting of past portions of the first signal comprisespredominantly weighting present and more recent portions of the firstsignal more heavily than earlier portions of the first signal, andwherein the frequency band includes one or more frequency components,and determine a phase of the frequency component based on a filteredsignal outputted from the correlation, and an averager configured todetermine a phase of the frequency band based on the determined phase ofthe frequency component, and a therapy module configured to delivertherapy based on the determined phase of the frequency band.

In one example, the disclosure describes a medical device comprisingmeans for receiving a first signal generated from a second signal, meansfor correlating the first signal with a frequency component of afrequency band of the second signal, wherein correlating includespredominantly decreasing weighting of past portions of the first signal,and wherein predominantly decreasing weighting of past portions of thefirst signal comprises predominantly weighting present and more recentportions of the first signal more heavily than earlier portions of thefirst signal, and wherein the frequency band includes one or morefrequency components, means for determining a phase of the frequencycomponent based on a filtered signal outputted from the correlation,means for determining a phase of the frequency band based on thedetermined phase of the frequency component, and means for deliveringtherapy based on the determined phase of the frequency band.

In one example, the disclosure describes a computer-readable storagemedium comprising instructions that when executed cause one or moreprocessors of a medical device to receive a first signal generated froma second signal, correlate the first signal with a frequency componentof a frequency band of the second signal, wherein correlating includespredominantly decreasing weighting of past portions of the first signal,and wherein predominantly decreasing weighting of past portions of thefirst signal comprises predominantly weighting present and more recentportions of the first signal more heavily than earlier portions of thefirst signal, and wherein the frequency band includes one or morefrequency components, determine a phase of the frequency component basedon a filtered signal outputted from the correlation, determine a phaseof the frequency band based on the determined phase of the frequencycomponent, and instruct a therapy module to deliver therapy based on thedetermined phase of the frequency band.

The details of one or more examples are set forth in the accompanyingdrawings and the description below. Other features, objects, andadvantages will be apparent from the description and drawings, and fromthe claims.

BRIEF DESCRIPTION OF DRAWINGS

FIG. 1 is a conceptual diagram illustrating an example deep brainstimulation (DBS) system configured to sense a bioelectrical brainsignal and deliver electrical stimulation therapy to a tissue sitewithin a brain of a patient.

FIG. 2 is functional block diagram illustrating components of an examplemedical device.

FIG. 3 is a block diagram illustrating components of an examplefrequency band phase detector.

FIG. 4A is a graph illustrating a constructed band with pre-filter for acollection of theta waves.

FIG. 4B is a graph illustrating another constructed band with pre-filterfor a collection of theta waves.

FIG. 5 is a block diagram illustrating an example of a frequencycomponent phase detector.

FIG. 6 is a flowchart illustrating a method in accordance with one ormore example techniques described in this disclosure.

FIG. 7 is a flowchart illustrating a method in accordance with one ormore example techniques described in this disclosure.

FIG. 8 is a functional block diagram illustrating components of anexample medical device programmer.

FIG. 9 is a graph illustrating a comparison of results between real-timephase detection techniques described in this disclosure andnon-real-time phase detection techniques.

FIG. 10 is a graph illustrating another comparison of results betweenreal-time phase detection techniques described in this disclosure andnon-real-time phase detection techniques.

DETAILED DESCRIPTION

The disclosure describes example ways to determine phase of a frequencyband within a signal. For purposes of illustration, the techniquesdescribed in this disclosure are described with respect to a frequencyband of a bioelectrical brain signal, such as the theta wave with afrequency band from 4 Hertz (Hz) to 8 Hz. However, the techniquesdescribed in this disclosure are not so limited, and can be extended toother signals as well, such as signals from accelerometers or variousother signals in which a phase of a frequency band is of interest. Forease, the examples are described for determining the phase of a thetawave.

Determining the phase of a frequency band may be useful for variouspurposes. As one example, delivery of medical therapy when the thetawave is at one phase may have different effect than delivery of medicaltherapy when the theta wave is at another phase. As another example,delivery of medical therapy at a phase of the theta wave other than theintended phase may result in less effective treatment.

In examples described in this disclosure, a frequency band phasedetector that determines a phase of the frequency band may include oneor more frequency component phase detectors, where each frequencycomponent phase detector determines a phase of a frequency componentwithin the frequency band. A frequency band phase detector may performreal-time Fourier transform (RTFT) may be considered as an RTFT block.

As an example, a frequency band phase detector for the frequency bandfrom 4 Hz to 8 Hz may include three frequency component phase detectors.A first frequency component phase detector may determine the phase forthe 4 Hz frequency component of the frequency band of the signal, asecond frequency component phase detector may determine the phase forthe 6 Hz frequency component of the frequency band of the signal, and athird frequency component phase detector may determine the phase for the8 Hz frequency component of the frequency band of the signal. The 4 Hz,6 Hz, and 8 Hz frequency components are provided for purposes ofillustration only.

In some examples, the frequency band phase detector may include more orfewer frequency component phase detectors than three frequency componentphase detectors. For example, if the frequency band includes only onefrequency component, than only one frequency component phase detectormay be utilized. To increase accuracy, the frequency band phase detectormay include frequency component phase detectors at 1 Hz separation,rather than 2 Hz separation (e.g., frequency component phase detectorsfor 4 Hz, 5 Hz, 6 Hz, 7 Hz, and 8 Hz, and possibly even finer separationsuch as 0.5 Hz). Also, in the above example, the width of the frequencyband is 4 Hz (8 Hz minus 4 Hz). As another example, if the frequencyband were wider (e.g., more than 4 Hz), the frequency band phasedetector may include more than three frequency component phasedetectors.

In some examples, the number of frequency component phase detectors inthe frequency band phase detector may be based on design of thefrequency component phase detectors. As described below, each frequencycomponent phase detector may include a “resonator,” and if the tails ofthe resonator (e.g., the filtering provided by the resonators atfrequencies other than the respective frequency component) is wide, thenthe frequency separation between frequency component phase detectors maybe larger than if the tails of the resonator are narrower. For widefrequency separation, fewer frequency component phase detectors may beused, as compared to narrow frequency separation, where more frequencycomponent phase detectors are used.

The frequency band phase detector may be configured to receive phaseinformation of the respective frequency components from respectivefrequency component phase detectors. The frequency band phase detectormay weight each of the phases, average the weighted phases, and outputthe result as phase information that indicates the phase of thefrequency band of the signal.

Each frequency component phase detector may be configured to determinethe phase of a respective frequency component by correlating the inputsignal with the frequency component for which it is configured, andweighing more recent portions of the signal more heavily than earlierportions of the signal, as part of the correlation. In other words, theeffect of earlier portions of the signal is less than the effect oflater portions of the signal in determining the phase of a frequencycomponent of the signal. For example, each frequency component phasedetector may include a weighted filter that filters the signal, based onrespective frequency components of a frequency band, where the filteringincludes correlating, with decreasing weighting of past portions of thesignal, the signal with the frequency component. As described above,each frequency component phase detector may output phase information forthe phases of respective frequency components, and the frequency bandphase detector may determine a weighted average of each of the phases ofthe respective frequency components to determine the phase of thefrequency band.

With the techniques described in this disclosure, it may be possible forthe frequency band phase detector to almost instantaneously determinethe current phase of the frequency band (e.g., real-time phase detectionof the frequency band) with minimal power and circuit real-estate (e.g.,negligible silicon area). Some other techniques for real-time phasedetection do not rely on weighing more recent portions of the signalmore heavily than earlier portions of the signal and averaging phases offrequency components of a frequency band for purposes of determining thephase of a frequency band. These other techniques may require a vastamount of power and circuit real-estate, which may not be available inmedical devices such as implantable, wearable, or portable medicaldevices.

FIG. 1 is a conceptual diagram illustrating an example therapy system 10that is configured to deliver therapy to patient 12 to manage a disorderof patient 12. In some examples, therapy system 10 may deliver therapyto patient 12 to manage a movement disorder or a neurodegenerativeimpairment of patient 12. Patient 12 ordinarily will be a human patient.In some cases, however, therapy system 10 may be applied to othermammalian or non-mammalian non-human patients. A movement disorder maybe characterized by one or more symptoms, such as, but not limited to,impaired muscle control, motion impairment or other movement problems,such as rigidity, bradykinesia, rhythmic hyperkinesia, nonrhythmichyperkinesia, dystonia, tremor, and akinesia. In some cases, themovement disorder may be a symptom of Parkinson's disease orHuntington's disease. However, the movement disorder may be attributableto other patient conditions.

Although movement disorders are primarily referred to throughout theremainder of the application, in other examples, therapy system 10 maybe configured to deliver therapy to manage other patient conditions,such as, but not limited to, seizure disorders (e.g., epilepsy),psychiatric disorders, behavior disorders, mood disorders, memorydisorders, mentation disorders, Alzheimer's disease, or otherneurological or psychiatric impairments, in addition to or instead of amovement disorder. Examples of psychiatric disorders include majordepressive disorder (MDD), bipolar disorder, anxiety disorders, posttraumatic stress disorder, dysthymic disorder, and obsessive compulsivedisorder (OCD). Treatment of other patient disorders via delivery oftherapy to brain 28 or another suitable target therapy delivery site inpatient 12 is also contemplated.

In the example shown in FIG. 1, therapy system 10 includes medicaldevice programmer 14, implantable medical device (IMD) 16, leadextension 18, and one or more leads 20A and 20B (collectively “leads20”) with respective sets of electrodes 24, 26. IMD 16 includes atherapy module that includes a stimulation generator that is configuredto generate and deliver electrical stimulation therapy to one or moreregions of brain 28 of patient 12 via a subset of electrodes 24, 26 ofleads 20A and 20B, respectively. In the example shown in FIG. 1, therapysystem 10 may be referred to as a deep brain stimulation (DBS) systembecause IMD 16 provides electrical stimulation therapy directly totissue within brain 28 (e.g., a tissue site under the dura mater ofbrain 28 or one or more branches or nodes, or a confluence of fibertracks).

In some examples, leads 20 may be positioned to deliver therapy to asurface of brain 28 (e.g., the cortical surface of brain 28). Forinstance, IMD 16 may provide cortical stimulation therapy to patient 12(e.g., by delivering electrical stimulation to one or more tissue sitesin the cortex of brain 28. In some examples, IMD 16 may provide vagalnerve stimulation (VNS) therapy to patient 12 by delivering electricalstimulation to one or more vagal nerve tissue sites.

Although electrical stimulation therapy is primarily referred tothroughout the remainder of the application, therapy system 10 may beconfigured to deliver other types of therapy in addition to or insteadof electrical stimulation therapy, such as (e.g., drug deliverytherapy). Moreover, for ease of description, the techniques described inthis disclosure are described with respect to system 10 in which IMD 16and leads 20A, 20B are implanted within the patient. However, thetechniques described in this disclosure are not so limited. Thetechniques described in this disclosure may be applicable toimplantable, wearable, and/or portable applications as well. Also,although the techniques are described with respect to medical devices,the techniques are not so limited and may be extended to non-medicaldevices as well.

In some examples, leads 20A, 20B may be implanted at other locationssuch as spinal cord, gastro, pelvic floor, peripheral nerve, etc. Also,there may be various therapies for different conditions such as pain,gastroparesis, obesity, urinary dysfunction, fecal dysfunction, orsexual dysfunction.

In the example shown in FIG. 1, IMD 16 may be implanted within asubcutaneous pocket in the pectoral region of patient 12. IMD 16 may beimplanted within other regions of patient 12, such as a subcutaneouspocket in the chest, abdomen or buttocks of patient 12 or proximate thecranium of patient 12. Implanted lead extension 18 is coupled to IMD 16via connector block 30 (also referred to as a header), which mayinclude, for example, electrical contacts that electrically couple torespective electrical contacts on lead extension 18. The electricalcontacts electrically couple the electrodes 24, 26 carried by leads 20to IMD 16. Lead extension 18 traverses from the implant site of IMD 16within a chest cavity of patient 12, along the neck of patient 12 andthrough the cranium of patient 12 to access brain 28. IMD 16 can beconstructed of a biocompatible material that resists corrosion anddegradation from bodily fluids. IMD 16 may comprise a hermetic housing34 to substantially enclose components, such as a processor, therapymodule, and memory.

In the example shown in FIG. 1, leads 20 are implanted within the rightand left hemispheres, respectively, of brain 28 in order to deliverelectrical stimulation to one or more regions of brain 28, which may beselected based on many factors, such as the type of patient conditionfor which therapy system 10 is implemented to manage. Other implantsites for leads 20 and IMD 16 are contemplated. For example, IMD 16 maybe implanted on or within cranium 32 or leads 20 may be implanted withinthe same hemisphere at multiple target tissue sites or IMD 16 may becoupled to a single lead that is implanted in one or both hemispheres ofbrain 28.

Leads 20 may be positioned to deliver electrical stimulation to one ormore target tissue sites within brain 28 to manage patient symptomsassociated with a disorder of patient 12. Leads 20 may be implanted toposition electrodes 24, 26 at desired locations of brain 28 throughrespective holes in cranium 32. Leads 20 may be placed at any locationwithin brain 28 such that electrodes 24, 26 are capable of providingelectrical stimulation to target tissue sites within brain 28 duringtreatment. Different neurological or psychiatric disorders may beassociated with activity in one or more of regions of brain 28, whichmay differ between patients. For example, a suitable target therapydelivery site within brain 28 for controlling a movement disorder ofpatient 12 may include one or more of the pedunculopontine nucleus(PPN), thalamus, basal ganglia structures (e.g., globus pallidus,substantia nigra or subthalamic nucleus), zona inserta, fiber tracts,lenticular fasciculus (and branches thereof), ansa lenticularis, and/orthe Field of Forel (thalamic fasciculus). The PPN may also be referredto as the pedunculopontine tegmental nucleus.

As another example, in the case of MDD, bipolar disorder, OCD, or otheranxiety disorders, leads 20 may be implanted to deliver electricalstimulation to the anterior limb of the internal capsule of brain 28,and only the ventral portion of the anterior limb of the internalcapsule (also referred to as a VC/VS), the subgenual component of thecingulate cortex (which may be referred to as CG25), anterior cingulatecortex Brodmann areas 32 and 24, various parts of the prefrontal cortex,including the dorsal lateral and medial pre-frontal cortex (PFC) (e.g.,Brodmann area 9), ventromedial prefrontal cortex (e.g., Brodmann area10), the lateral and medial orbitofrontal cortex (e.g., Brodmann area11), the medial or nucleus accumbens, thalamus, intralaminar thalamicnuclei, amygdala, hippocampus, the lateral hypothalamus, the Locusceruleus, the dorsal raphe nucleus, ventral tegmentum, the substantianigra, subthalamic nucleus, the inferior thalamic peduncle, the dorsalmedial nucleus of the thalamus, the habenula, the bed nucleus of thestria terminalis, or any combination thereof. Target tissue sites notlocated in brain 28 of patient 12 are also contemplated.

As another example, in the case of a seizure disorder or Alzheimer'sdisease, for example, leads 20 may be implanted to deliver electricalstimulation to regions within the Circuit of Papez, such as the anteriorthalamic nucleus, the internal capsule, the cingulate, the fornix, themammillary bodies, the mammillothalamic tract (mammillothalamicfasciculus), and/or hippocampus, as a few examples. In the case of aseizure disorder, IMD 16 may deliver therapy to a region of brain 28 viaa selected subset of electrodes 24, 26 to suppress cortical activitywithin the anterior thalamic nucleus, hippocampus, or other brain regionassociated with the occurrence of seizures (e.g., a seizure focus ofbrain 28). Conversely, in the case of Alzheimer's disease, IMD 16 maydeliver therapy to a region of brain 28 via electrodes 24, 26 toincrease cortical activity within the anterior thalamic nucleus,hippocampus, or other brain region associated with Alzheimer's disease.As another example, in the case of depression (e.g., MDD), IMD 16 maydeliver therapy to a region of brain 28 via electrodes 24, 26 toincrease cortical activity within one or more regions of brain 28 toeffectively treat the patient disorder. As another example, IMD 16 maydeliver therapy to a region of brain 28 via electrodes 24, 26 todecrease cortical activity within one or more regions of brain 28, suchas the frontal cortex, as one example, to treat the disorder.

Although leads 20 are shown in FIG. 1 as being coupled to a common leadextension 18, in other examples, leads 20 may be coupled to IMD 16 viaseparate lead extensions or directly coupled to IMD 16. Moreover,although FIG. 1 illustrates system 10 as including two leads 20A and 20Bcoupled to IMD 16 via lead extension 18, in some examples, system 10 mayinclude one lead or more than two leads.

Leads 20 may be implanted within a desired location of brain 28 via anysuitable technique, such as through respective burr holes in the skullof patient 12 or through a common burr hole in the cranium 32. Leads 20may be placed at any location within brain 28 such that electrodes 24,26 of leads 20 are capable of providing electrical stimulation totargeted tissue during treatment. Electrical stimulation generated fromthe stimulation generator (not shown) within the therapy module of IMD16 may help mitigate the symptoms of movement disorders, such as byimproving the performance of motor tasks by patient 12 that mayotherwise be difficult. These tasks may include, for example, at leastone of initiating movement, maintaining movement, grasping and movingobjects, improving gait and balance associated with narrow turns, andthe like. The exact therapy parameter values of the electricalstimulation therapy that may help mitigate symptoms of the movementdisorder (or other patient condition) may be specific for the particulartarget stimulation site (e.g., the region of the brain) involved as wellas the particular patient and patient condition.

In the examples shown in FIG. 1, electrodes 24, 26 of leads 20 are shownas ring electrodes. Ring electrodes may be relatively easy to programand are typically capable of delivering an electrical field to anytissue adjacent to leads 20. In other examples, electrodes 24, 26 ofleads 20 may have different configurations. For example, electrodes 24,26 of leads 20 may have a complex electrode array geometry that iscapable of producing shaped electrical fields, including interleavedstimulation. An example of a complex electrode array geometry, mayinclude an array of electrodes positioned at different axial positionsalong the length of a lead, as well as at different angular positionsabout the periphery, e.g., circumference, of the lead. The complexelectrode array geometry may include multiple electrodes (e.g., partialring or segmented electrodes) around the perimeter of each lead 20, inaddition to, or instead of, a ring electrode. In this manner, electricalstimulation may be directed to a specific direction from leads 20 toenhance therapy efficacy and reduce possible adverse side effects fromstimulating a large volume of tissue. In some examples in which multipleleads 20 are implanted on the same hemisphere surrounding a target,steered electrical stimulation can be performed in between two or moreelectrodes.

In some examples, outer housing 34 of IMD 16 may include one or morestimulation and/or sensing electrodes. For example, housing 34 cancomprise an electrically conductive material that is exposed to tissueof patient 12 when IMD 16 is implanted in patient 12, or an electrodecan be attached to housing 34. Leads 20 may have shapes other thanelongated cylinders as shown in FIG. 1 with active or passive tipconfigurations. For example, leads 20 may be paddle leads, sphericalleads, bendable leads, or any other type of shape effective in treatingpatient 12.

IMD 16 may deliver electrical stimulation therapy to brain 28 of patient12 according to one or more stimulation therapy programs. A stimulationtherapy program may define one or more electrical stimulation parametervalues for therapy generated by a therapy module of IMD 16 and deliveredfrom IMD 16 to brain 28 of patient 12. Where IMD 16 delivers electricalstimulation in the form of electrical pulses, for example, theelectrical stimulation parameters may include amplitude mode (constantcurrent or constant voltage with or without multiple independent paths),pulse amplitude, pulse rate, pulse width, a waveform shape, and cyclingparameters (e.g., with our without cycling, duration of cycling, and thelike). In addition, if different electrodes are available for deliveryof stimulation, a therapy parameter of a therapy program may be furthercharacterized by an electrode combination, which may define selectedelectrodes and their respective polarities.

In some examples, IMD 16 is configured to deliver electrical stimulationtherapy to brain 28 of patient 12 in an open loop manner, in which IMD16 delivers the stimulation therapy without intervention from a user ora sensor. In some examples, IMD 16 is configured to deliver electricalstimulation therapy to brain 28 of patient 12 in a closed loop manner ora pseudo-closed loop manner, in which IMD 16 controls the timing of thedelivery of electrical stimulation to brain 28, the output parameters ofthe electrical stimulation, or both based on one or more of user inputand input from a sensor. The sensor may, for example, provide feedbackthat may be used to control the electrical stimulation output from IMD16.

In addition to being configured to deliver therapy to manage a disorderof patient 12, therapy system 10 is configured to sense bioelectricalbrain signals of patient 12. For example, IMD 16 may include a sensingmodule that is configured to sense bioelectrical brain signals withinone or more regions of brain 28 via a subset of electrodes 24, 26,another set of electrodes, or both. Accordingly, in some examples,electrodes 24, 26 may be used to deliver electrical stimulation from thetherapy module to target sites within brain 28 as well as sense brainsignals within brain 28. However, IMD 16 can also use a separate set ofsensing electrodes to sense the bioelectrical brain signals. In theexample shown in FIG. 1, the signals generated by electrodes 24, 26 areconducted to the sensing module within IMD 16 via conductors within therespective lead 20A, 20B. In some examples, the sensing module of IMD 16may sense bioelectrical brain signals via one or more of the electrodes24, 26 that are also used to deliver electrical stimulation to brain 28.In some examples, one or more of electrodes 24, 26 may be used to sensebioelectrical brain signals while one or more different electrodes 24,26 may be used to deliver electrical stimulation.

Depending on the particular stimulation electrodes and sense electrodesused by IMD 16, IMD 16 may monitor bioelectrical brain signals anddeliver electrical stimulation at the same region of brain 28 or atdifferent regions of brain 28. In some examples, the electrodes used tosense bioelectrical brain signals may be located on the same lead usedto deliver electrical stimulation, while in other examples, theelectrodes used to sense bioelectrical brain signals may be located on adifferent lead than the electrodes used to deliver electricalstimulation. In some examples, a bioelectrical brain signal of patient12 may be monitored with external electrodes (e.g., scalp electrodes).Moreover, in some examples, the sensing module that senses bioelectricalbrain signals of brain 28 (e.g., the sensing module that generates anelectrical signal indicative of the activity within brain 28) is in aphysically separate housing from outer housing 34 of IMD 16. However, inthe example shown in FIG. 1 and the example referred to herein for easeof description, the sensing module and therapy module of IMD 16 areenclosed within a common outer housing 34.

The bioelectrical brain signals sensed by IMD 16 may reflect changes inelectrical current produced by the sum of electrical potentialdifferences across brain tissue. Example bioelectrical brain signalsinclude, but are not limited to, an electroencephalogram (EEG) signal,an electrocorticogram (ECoG) signal, a local field potential (LFP)sensed from within one or more regions of a patient's brain, and/oraction potentials from single cells within the patient's brain. In someexamples, LFP data can be measured ipsilaterally or contralaterally andconsidered as an average (e.g., a maximum or minimum or a heuristiccombination thereof) or as some other value. The location at which thesignals are obtained may be adjusted to a disease onset side of the bodyof patient 12 or severity of symptoms or disease duration. Theadjustments, may, for example, be made on the basis of clinical symptomspresented and their severity, which can be augmented or annotated withrecorded LFP data. A clinician or a processor of IMD 16 may also addheuristic weights to ipsilaterally and/or contralaterally measured LFPdata to be considered for system feedback.

In examples described in this disclosure, IMD 16 is configured todetermine a phase of a frequency band of a signal, such as a frequencyband of a bioelectrical brain signal. The bioelectrical brain signalincludes a plurality of different frequency bands that are each usefulfor different therapies. For example, the activity of a bioelectricalbrain signal of a patient in a frequency band of interest that may beindicative of a patient state includes, for example, a spectral patternof a bioelectrical brain signal, a power level of a bioelectrical brainsignal in one or more frequency sub-bands (e.g., two or more frequencysub-bands) of a frequency band, or both. The patient state can be, forexample, a patient disease state, a state in which a symptom of apatient condition is observed, or a patient state indicative of theefficacy of therapy delivery by a medical device or the efficacy ofmedication.

Different frequency bands of a bioelectrical brain signal are associatedwith different brain activity of the patient. One example of thefrequency bands is shown in Table 1 below:

TABLE 1 Frequency (f) Band Frequency Hertz (Hz) Information f < 4 Hz δ(delta frequency band) 4 Hz ≤ f < 8 Hz theta frequency band  8 Hz ≤ f <13 Hz α (alpha frequency band) 13 Hz < f < 35 Hz β (beta frequency band) 35 Hz ≤ f < 100 Hz γ (gamma frequency band) 100 Hz < f < 400 Hz high γ(high gamma frequency band)

However, the frequency bands may have different frequency ranges thanthe example of Table 1. A frequency band may include (e.g., may be madeup of) a plurality of frequency components, with a certain separation.As an illustrative example, the theta frequency band has a width of 4 Hz(8 Hz minus 4 Hz). In one example, the theta wave includes fivefrequency components with 1 Hz separation (e.g., 4 Hz, 5 Hz, 6 Hz, 7 Hz,and 8 Hz). In one example, the theta wave includes nine frequencycomponents with 0.5 Hz separation (e.g., 4 Hz, 4.5 Hz, 5 Hz, 5.5 Hz, 6Hz, 6.5 Hz, 7 Hz, 7.5 Hz, and 8 Hz). In one example, the theta waveincludes three frequency components with 2 Hz separation (e.g., 4 Hz, 6Hz, and 8 Hz). There may be an infinite number of frequency componentsin a frequency band with an infinitely small separation.

There may be various reasons for determining the phase of the frequencyband of interest. For example, oscillatory rhythms in the brain are ofgreat interest to the neuroscience, neurology, and neural interfacecommunities; and a key signal characteristic emerging as at the focus ofrecent research is signal phase and phase locking. For instance, bothneuronal phase locking and oscillatory phase locking within and acrossstructures are correlated with memory strength and with attention andgaiting of information flow. Also, memory encoding may be separated frommemory retrieval by the phase at which neurons fire, while phasecoupling across frequencies and across brain structures has beenstrongly implicated in information transfer and processing within thebrain. Many have reported the locking of high-frequency brainoscillations to specific phases of lower-frequency oscillations.

These phase-dependent mechanisms have been implicated in the coding ofinformation, and the differential strengthening and weakening of neuralconnections with brain networks. It has been shown that electricalstimulation at the peak of a hippocampal theta wave induces long-termpotentiation (synaptic strengthening) while stimulation applied to thetrough induces long term synaptic depression: two changes thought to berelated to memory storage in neural systems. Furthermore, some studiesdescribe simulation studies that demonstrate phase dependent differencesin stimulation effects, with the highest effectiveness of stimulationoccurring at the peak the simulated network's bursting phase, resultingin reduction or elimination of burst firing. Thus, phase dependence withrespect to local network oscillations appears to affect both neuronalconnectivity patterns and network activity.

For instance, with LFP and EEG signals, phase detection allows IMD 16 toprovide therapy at the correct phase needed to achieve the desiredeffect. As one example, IMD 16 may induce long-term potentiation if IMD16 provides electrical stimulation at a peak of the hippocampal thetawave (e.g., when the phase of the hippocampal theta wave is 90°). IMD 16may induce long term depression, where depression here is meant as theopposite of potentiation, if IMD 16 provides electrical stimulation at atrough of the hippocampal theta wave (e.g., when the phase of thehippocampal theta wave is 270°). Long term potentiation and depressionare changes understood to be related to memory storage in neuralsystems.

Because the phase of the frequency band of the theta wave determineswhen therapy should be delivered, IMD 16 may be configured for real-timephase detection of the frequency band. However, the techniques describedin this disclosure should not be considered as requiring real-time phasedetection, and may be usable in various systems in which phase detectionof a signal is of interest.

In this disclosure, real-time phase detection refers to determining theinstantaneous, current phase of the signal. In other words, very littletime may elapse between when IMD 16 determined the phase of thefrequency band and the actual phase of the frequency band. As anillustrative example of real-time phase detection, assume that thesignal is a sinusoid. In this example, when the amplitude of signalchanges from positive to negative, the phase of the signal is 180°. Withthe real-time phase detection techniques described in this disclosure,no appreciable time elapses between when the amplitude of the signalchanges from positive to negative to when IMD 16 determines that thephase of the signal is 180°. Stated yet another way, very little to noportion of the signal, following the time from the point of the signalat which IMD 16 is to determine the phase of the signal, is received byIMD 16 by the time IMD 16 completes determining the phase of the signal.

Real-time phase detection may be beneficial for various purposes. Forexamples of IMD 16 that sense LFP or EEG signals, real-time phasedetection may also improve the ability of IMD 16 to respond to changesin brain state when real-time coupling between other frequency bandsserves as an indicator of brain state and the brain state is needed tobe known in real-time for the appropriate application of therapy. Forexample, real-time phase detection may be used in a Phase AmplitudeCoupling (PAC) circuit that correlates the amplitude of a gamma waveformto a phase of theta or that correlates the amplitude of a gamma waveformto a phase of beta.

In some cases, using the phase of a frequency band to determine when todeliver therapy may provide for more effective treatment than usingother techniques. For example, some techniques may rely on amplitudedetection to determine when to deliver therapy or to determine when asubsequent amplitude will occur to determine when therapy is to bedelivered. However, the amount of time needed for amplitude detectionmay be too long to provide therapy at the exact intended amplitude.Also, techniques that rely on amplitude detection to predict theoccurrence of when the signal will subsequently be at the intendedamplitude are imprecise, which may result in less efficacious treatment.

This disclosure describes example ways in which IMD 16 determines thereal-time phase of a frequency band of a signal. Because IMD 16 isimplantable, and in some examples, a medical device configured toimplement the techniques described in this disclosure may be wearable orotherwise portable, the disclosure describes accurate and computationalefficient real-time phase detection. For instance, other techniques forreal-time phase detection may require more power than would be advisablefor a medical device to deliver and/or may require more circuit spacethan available on a medical device such as for medical devices that areimplantable, wearable, or otherwise portable.

The real-time phase detection techniques may be applied in continuous ordiscrete time (e.g., on an analog signal or a digital signal). For easeof description, the real-time phase detection techniques are describedwith respect to a digital signal, in which IMD 16 converts the analogbioelectrical brain signal to a digital bioelectrical brain signal, andimplements the techniques on the digital signal. Accordingly, thereal-time phase detection techniques are described with respect todigital components such as digital filters. However, the techniquesdescribed in this disclosure may be applied to the analog bioelectricalbrain signal using analog components such as analog filters.

Moreover, the real-time phase detection techniques may be applied at anyfrequency and to any frequency band, and applied to all forms ofsignals, including electrical, mechanical, pressure, and the like. Forease of description, the real-time phase detection techniques aredescribed with respect to different frequency bands of neurologicalactivity in the near or far field, such as for detection the real-timephase of a theta wave in an EEG, where the theta wave includes afrequency band of 4 Hz to 8 Hz of the EEG. However, the techniques canbe applied to non-neurological applications, and even non-medicalapplications such as determining phase of signal outputted by anaccelerometer as part of therapy delivery or in examples where theaccelerometer is not used for therapy delivery.

As described in more detail below, IMD 16 includes a frequency bandphase detector. The frequency band phase detector may be configured forthe frequency band of interest (e.g., for the theta wave, as oneexample). The frequency band phase detector includes one or morefrequency component phase detectors, where each frequency componentphase detector determines the real-time phase of respective frequencycomponents of the frequency band. The number of frequency componentphase detectors may be a function of balancing accuracy, powerconsumption, and the width of the frequency band.

For example, the frequency band phase detector may include one frequencycomponent phase detector. In this example, the power consumption may beless than examples where the frequency band phase detector includes aplurality of frequency component phase detectors, but the determinedphase may be less accurate than examples where the frequency band phasedetector includes a plurality of frequency component phase detectors.For purposes of illustration, the disclosure describes examples wherethe frequency band phase detector includes three frequency componentphase detectors (e.g., one for 4 Hz, one for 6 Hz, and one for 8 Hz),but more or fewer frequency component phase detectors if greater orlesser frequency separation may be possible.

Also, for the theta wave, the width of the frequency band is 4 Hz (8 Hzminus 4 Hz). If the frequency band is wider than 4 Hz, then thefrequency band phase detector may include more than three frequencycomponent phase detectors. In this example, the frequency separationbetween each frequency component may be 2 Hz, like in the previousexample of one frequency component phase detector for 4 Hz, another for6 Hz, and a third for 8 Hz, or the frequency separation between eachfrequency component may be greater than or less than 2 Hz.

Each of the frequency component phase detectors output phase informationindicating the phases of respective frequency components. The frequencyband phase detector may determine an average (and in some examples, aweighted average) of the phases of each of the respective frequencycomponents. The result of the averaging may be the real-time phase ofthe frequency band.

To determine the phases of the frequency components, each of thefrequency component phase detectors may filter the signal based on thefrequency components of respective frequency component phase detectors,wherein the filtering includes correlating the signal with the frequencycomponent for which the frequency component phase detector is configuredand by weighing present and more recent portions of the signal atrespective frequency components more heavily than earlier portions ofthe signal as part of the correlation. Also, in some examples, portionsof the signal that are received after the instance of when the phase ofthe frequency band is to be determined may not be used to determine thephase to promote real-time phase detection. In other words, thefrequency component phase detectors may determine the phase ofrespective frequency components without utilizing any portion of thesignal that follows in time from the point of the signal at which thephase of the frequency component is determined.

For example, the filtering includes weighing present and more recentportions of the signal at respective frequency components more heavilythan earlier portions of the signal by measuring the projection on twoelements of a basis set that form phase pairs as determined byperforming a correlation operation against those elements. Furthermore,the correlation in the more recent past is weighted more heavily (as itis considered more predictive) than the more distant past in measuringphase. A properly windowed Fourier transform is an example of thistechnique applied to the basis set pair described by e^(jwt) ore^(−jwt), where e^(jwt) is mathematically equal to sin(wt)+j cos(wt) ande^(−jwt) is mathematically equal to sin(wt)−j cos(wt).

In general, the filtering may be considered as correlating the signalwith the frequency component, by weighing more recent portions of theinput signal more heavily than earlier portions of the input signal.When the correlation is based on a sine and cosine waves, thecorrelation may be considered as a modulation. One way to modulate thesignal is by a Fourier transform, in which the signal is modulated bysine and cosine waveforms whose frequency is equal to the frequency ofthe frequency component for which the frequency component phase detectoris configured. In the techniques described in this disclosure, ratherthan using a symmetric window for the Fourier transform, a non-symmetricwindow is utilized so that earlier portions of the signal are weighedless than more recent portions of the signal.

The sine wave and cosine wave are examples of a basis set, where a basisset includes waveforms (e.g., mathematical functions) that can be usedto form the signal. For example, sine and cosine waves can be used toform the theta wave. However, other examples of basis sets may be used,such as triangular waves as one example. The Fourier transform is usedbecause the derivative of e^(−jwt) is e^(−jwt), and tends to increasecomputational efficiency and ease of design.

In other words, a Fourier transform measures the projection on aspecific element of the basis set described by sin wt/cos wt ore^(+/−jwt). The Fourier transform operation is equivalent to performinga correlation operation against sin wt, cos wt or e^(−jwt) to find theprojection onto that element of that basis set. It may be possible toperform such a correlation with any basis set element pair to find theprojection (and phase) on these elements of the basis set. As oneexample, a collection of triangular waveforms that are orthogonal andcomplete could be used. In this example, orthogonal means an elementcannot be formed from other elements and complete means any input signalcan be described by a collection of elements. If a theta wave hasharmonics, and in some examples a theta wave does have harmonics, it maybe possible to use a basis set that is more ideal (e.g., triangularlike) and measure the projection onto an element pair to determine thephase. The disclosure uses e^(−jwt) as the basis set because it is thederivative of itself, greatly increasing computational efficiency.Although other basis sets are possible, the disclosure described withrespect to the basis set of a Fourier transform.

In a digital application, each of the frequency component phasedetectors receives samples of the signal, where the signal is sampled ata sampling frequency. As one example, each of the frequency componentphase detectors may determine an estimate of the real-time phase ofrespective frequency components based on a decreasing weighting of thepast samples, and in some examples, a nearly monotonically decreasingweighting of the past samples. The phrase “decreasing weighting” or“decaying weighting” means that the weight assigned to earlier samplesis reduced, so that present and more recent samples are weighted moreheavily than earlier samples

The decreasing weighting of the past samples means a general decreasingweighting of the past samples. It may be possible for there not to bedecreased weighting of one or more past samples, but there may be ageneral trend of decreased weighting. For instance, on average theweighting of past samples is decreasing. In this disclosure, the term“predominantly decreasing” is used to mean that in general the weightingof past samples is decreasing. However, in portions of the disclosure,where the term “predominantly” is not used, it should be assumed thatthe weighting is generally decreasing (or even always decreasing), andnot as a requirement that every previous sample be weighted indecreasing manner.

The weighting of the future sample may be zero for a real-time phasedetection algorithm. However, it may be possible to utilize a few futuresamples to increase accuracy, but with a slight delay in phasedetection. For instance, if exact real-time phase detection is notnecessary, and a slight delay can be tolerated, then it may be possibleto utilize future samples. In the techniques described in thisdisclosure, future samples are excluded. Also, for analog applications,rather than predominantly decreasing weighting of the past samples ofthe signal, each of the frequency component phase detectors may decreasethe weighting of the past portions of the signal. In this disclosure,the “portion of the signal” is used to generically refer to digitalsignals or analog signals.

One example way in which each of the frequency component phase detectorsmay weigh present and more recent samples more heavily than earliersamples of the signal is by a filter that implements a discrete timeFourier transform with exponentially decaying weighting of samples ofthe signal. The phrase “exponentially decaying” means that the weightingis reducing exponentially. One reason that each of the frequencycomponent phase detectors may utilize a filter that implements adiscrete time Fourier transform with exponentially decaying weighting isthat such a filter may be implemented with high computationalefficiency.

For example, the Fourier transform may be considered as a way tocorrelate the input signal with the frequency component to which therespective frequency component phase detectors are configured with abasis set that includes sine and cosine waves. With a Fourier transform,the correlation may be considered as a modulation with sine and cosinewaves. However, the techniques described in this disclosure are notlimited to correlation that uses a Fourier transform, and othercorrelation using other basis sets may be possible.

Moreover, the techniques described in this disclosure, however, are notlimited to example filters that implement a discrete time Fouriertransform with exponentially decaying weighting. For example, thefrequency component phase detectors may each include a filter thatimplement exponentially decaying weighting of samples of the signalwithout using a discrete time Fourier transform. In some examples, thefrequency component phase detectors may each include a filter that doesnot implement exponentially decaying weighting of samples of the signal.Rather, the frequency component phase detectors may each include afilter that implements other types of decaying weighting. As oneexample, each filter may implement a linear decaying weighting. Asanother example, each filter may implement a step-wise decayingweighting with multiple steps. Other ways in which decaying weightingmay be implemented, and the techniques described above should not beconsidered limiting. Also, decaying weighting for analog signals, ratherthan digital samples, may also be possible, and implemented in variousways such as using resistor-capacitor (RC) low pass filters, as onenon-limiting example.

With a frequency band phase detector that averages the phase informationof phases outputted by one or more frequency component phase detectorsthat each determine the phase of respective frequency components using adecaying weighting scheme, the frequency band phase detector may beconfigured to output real-time phase information at a relatively highdata rate, and reducing or eliminating latency in knowledge of thereal-time phase. In some examples, a minimal amount of current may beneeded for such real-time phase detection (e.g., <1 micro-amps) withouta drastic increase in circuit space within IMD 16. The frequency bandphase detector and its one or more frequency component phase detectorsare described in more detail with respect to FIGS. 3 and 5. Prior todescribing the frequency band phase detector and the one or morefrequency component phase detectors, the following describes theremainder of system 10 in greater detail, and an example of IMD 16 ingreater detail.

FIG. 1 illustrates external programmer 14. External programmer 14 isconfigured to wirelessly communicate with IMD 16 as needed to provide orretrieve therapy information. Programmer 14 is an external computingdevice that the user (e.g., the clinician and/or patient 12) may use tocommunicate with IMD 16. For example, programmer 14 may be a clinicianprogrammer that the clinician uses to communicate with IMD 16 andprogram one or more therapy programs for IMD 16. In addition, orinstead, programmer 14 may be a patient programmer that allows patient12 to select programs and/or view and modify therapy parameter values.The clinician programmer may include more programming features than thepatient programmer. In other words, more complex or sensitive tasks mayonly be allowed by the clinician programmer to prevent an untrainedpatient from making undesired changes to IMD 16.

Programmer 14 may be a hand-held computing device with a displayviewable by the user and an interface for providing input to programmer14 (i.e., a user input mechanism). For example, programmer 14 mayinclude a small display screen (e.g., a liquid crystal display (LCD) ora light emitting diode (LED) display) that presents information to theuser. In addition, programmer 14 may include a touch screen display,keypad, buttons, a peripheral pointing device or another input mechanismthat allows the user to navigate though the user interface of programmer14 and provide input. If programmer 14 includes buttons and a keypad,the buttons may be dedicated to performing a certain function (i.e., apower button), the buttons and the keypad may be soft keys that changein function depending upon the section of the user interface currentlyviewed by the user, or any combination thereof. In some examples, thescreen (not shown) of programmer 14 may be a touch screen that allowsthe user to provide input directly to the user interface shown on thedisplay. The user may use a stylus or their finger to provide input tothe display.

In some examples, programmer 14 may be a larger workstation or aseparate application within another multi-function device, rather than adedicated computing device. For example, the multi-function device maybe a notebook computer, tablet computer, workstation, cellular phone,personal digital assistant or another computing device that may run anapplication that enables the computing device to operate as a securemedical device programmer 14. A wireless adapter coupled to thecomputing device may enable secure communication between the computingdevice and IMD 16.

When programmer 14 is configured for use by the clinician, programmer 14may be used to transmit initial programming information to IMD 16. Thisinitial information may include hardware information, such as the typeof leads 20, the arrangement of electrodes 24, 26 on leads 20, theposition of leads 20 within brain 28, initial programs defining therapyparameter values, and any other information that may be useful forprogramming into IMD 16. Programmer 14 may also be capable of completingfunctional tests (e.g., measuring the impedance of electrodes 24, 26 ofleads 20).

The clinician may also generate and store therapy programs within IMD 16with the aid of programmer 14. During a programming session, theclinician may determine one or more therapy programs that may provideefficacious therapy to patient 12 to address symptoms associated withthe movement disorder (or other patient conditions). For example, theclinician may select one or more electrode combinations with whichstimulation is delivered to brain 28. During the programming session,patient 12 may provide feedback to the clinician as to the efficacy ofthe specific program being evaluated or the clinician may evaluate theefficacy based on one or more sensed or observable physiologicalparameters of patient (e.g., muscle activity) or based on motiondetected via one or more motion sensors that generate signals indicativeof motion of patient 12. Programmer 14 may assist the clinician in thecreation/identification of therapy programs by providing a methodicalsystem for identifying potentially beneficial therapy parameter values.

Programmer 14 may also be configured for use by patient 12. Whenconfigured as a patient programmer, programmer 14 may have limitedfunctionality (compared to a clinician programmer) in order to preventpatient 12 from altering critical functions of IMD 16 or applicationsthat may be detrimental to patient 12.

Whether programmer 14 is configured for clinician or patient use,programmer 14 is configured to communicate to IMD 16 and, optionally,another computing device, via wireless communication. Programmer 14, forexample, may communicate via wireless communication with IMD 16 usingradio frequency (RF) telemetry techniques known in the art. Programmer14 may also communicate with another programmer or computing device viaa wired or wireless connection using any of a variety of local wirelesscommunication techniques, such as RF communication according to the802.11 or Bluetooth specification sets, infrared (IR) communicationaccording to the IRDA specification set, or other standard orproprietary telemetry protocols. Programmer 14 may also communicate withother programming or computing devices via exchange of removable media,such as magnetic or optical disks, memory cards or memory sticks.Further, programmer 14 may communicate with IMD 16 and anotherprogrammer via remote telemetry techniques known in the art,communicating via a local area network (LAN), wide area network (WAN),public switched telephone network (PSTN), or cellular telephone network,for example.

Therapy system 10 may be implemented to provide chronic stimulationtherapy to patient 12 over the course of several months or years.However, system 10 may also be employed on a trial basis to evaluatetherapy before committing to full implantation. If implementedtemporarily, some components of system 10 may not be implanted withinpatient 12. For example, patient 12 may be fitted with an externalmedical device, such as a trial stimulator, rather than IMD 16. Theexternal medical device may be coupled to percutaneous leads or toimplanted leads via a percutaneous extension. If the trial stimulatorindicates DBS system 10 provides effective treatment to patient 12, theclinician may implant a chronic stimulator within patient 12 forrelatively long-term treatment.

System 10 shown in FIG. 1 is merely one example of a therapy system thatis configured to determine a patient state based on activity of abioelectrical brain signal of patient 12 in one or more frequency bands.Systems with other configurations of leads, electrodes, and sensors arepossible. For example, in other implementations, IMD 16 may be coupledto additional leads or lead segments having one or more electrodespositioned at different target tissue sites, which may be within brain28 or outside of brain (e.g., proximate to a spinal cord of patient 12,a peripheral nerve of patient 12, a muscle of patient 12, or any othersuitable therapy delivery site). The additional leads may be used fordelivering different stimulation therapies to respective stimulationsites within patient 12 or for monitoring at least one physiologicalparameter of patient 12.

Additionally, in other examples, a system may include more than one IMD.For example, a system may include two IMDs coupled to respective one ormore leads. Each IMD can deliver stimulation to a respective lateralside of patient 12 in some examples.

As another example configuration, a therapy system can include one ormore leadless electrical stimulators (e.g., microstimulators having asmaller form factor than IMD 16 and may not be coupled to any separateleads). The leadless electrical stimulators can be configured togenerate and deliver electrical stimulation therapy to patient 12 viaone or more electrodes on an outer housing of the electrical stimulator.In examples including a plurality of leadless electrical stimulators,the leadless electrical stimulators can be implanted at different targettissue sites within patient 12. One electrical stimulator may act as a“master” module that coordinates the delivery of stimulation to patient12 via the plurality of electrical stimulators.

In some examples, IMD 16 is not configured to delivery electricalstimulation therapy to brain of patient 12, but, rather, is onlyconfigured to sense one or more physiological parameters of patient 12,including a bioelectrical brain signal of patient 12. This type of IMD16 may a patient monitoring device useful for diagnosing patient 12,monitoring a patient condition 12, or to train IMD 16 or another IMD fortherapy delivery.

FIG. 2 is functional block diagram illustrating components of an exampleIMD 16. In the example shown in FIG. 2, IMD 16 includes processor 60,memory 62, therapy module 65, telemetry module 70, and power source 72.Memory 62, as well as other memories described herein, may include anyvolatile or non-volatile media, such as a random access memory (RAM),read only memory (ROM), non-volatile RAM (NVRAM), electrically erasableprogrammable ROM (EEPROM), flash memory, and the like. Memory 62 maystore computer-readable instructions that, when executed by processor60, cause IMD 16 to perform various functions described herein.

Therapy module 65 includes stimulation generator 64, sensing module 66,and switch module 68. Therapy module 65 may be configured to delivertherapy based on the determined phase of the frequency band, where thephase of the frequency band is determined in accordance with the exampletechniques. For instance, as described in more detail below, stimulationgenerator 64 may deliver therapy based on a determination by comparator80 of processor 60. Accordingly, in some examples, processor 60 mayinstruct therapy module 65 to delivery therapy based on the determinedphase of the frequency band.

In the example shown in FIG. 2, memory 62 stores therapy programs 74 andoperating instructions 76 (e.g., in separate memories within memory 62or separate areas within memory 62). Operating instructions 76 mayinclude instructions that cause one or more processors (e.g., processor60) to implement the example techniques described in this disclosure.

Each stored therapy program 74 defines a particular program of therapyin terms of respective values for electrical stimulation parameters,such as a stimulation electrode combination, electrode polarity, currentor voltage amplitude, and, if stimulation generator 64 generates anddelivers stimulation pulses, the therapy programs may define values fora pulse width, and pulse rate of a stimulation signal. Each storedtherapy program 74 may also be referred to as a set of therapy parametervalues. In some examples, the therapy programs may be stored as atherapy group, which defines a set of therapy programs with whichstimulation may be generated. The stimulation signals defined by thetherapy programs of the therapy group may be delivered together on anoverlapping or non-overlapping (e.g., time-interleaved) basis.

Stimulation generator 64, under the control of processor 60, generatesstimulation signals for delivery to patient 12 via selected combinationsof electrodes 24, 26. In some examples, stimulation generator 64generates and delivers stimulation signals to one or more target regionsof brain 28 (FIG. 1), via a select combination of electrodes 24, 26,based on one or more stored therapy programs 74. The target tissue siteswithin brain 28 for stimulation signals or other types of therapy andstimulation parameter values may depend on the patient condition forwhich therapy system 10 is implemented to manage. While stimulationpulses are described, stimulation signals may be of any form, such ascontinuous-time signals (e.g., sine waves) or the like.

The processors described in this disclosure, including processor 60, mayinclude one or more digital signal processors (DSPs), general purposemicroprocessors, application specific integrated circuits (ASICs), fieldprogrammable logic arrays (FPGAs), or other equivalent integrated ordiscrete logic circuitry, or combinations thereof. The functionsattributed to processors described herein may be provided by a hardwaredevice and embodied as software, firmware, hardware, or any combinationthereof. Processor 60 is configured to control stimulation generator 64according to therapy programs 74 stored by memory 62 to apply particularstimulation parameter values specified by one or more programs, such asamplitude, pulse width, and pulse rate.

In the example shown in FIG. 2, the set of electrodes 24 of lead 20Aincludes electrodes 24A, 24B, 24C, and 24D, and the set of electrodes 26of lead 20B includes electrodes 26A, 26B, 26C, and 26D. Processor 60 maycontrol switch module 68 to apply the stimulation signals generated bystimulation generator 64 to selected combinations of electrodes 24, 26.In particular, switch module 68 may couple stimulation signals toselected conductors within leads 20, which, in turn, deliver thestimulation signals across selected electrodes 24, 26. Switch module 68may be a switch array, switch matrix, multiplexer, or any other type ofswitching module configured to selectively couple stimulation energy toselected electrodes 24, 26 and to selectively sense bioelectrical brainsignals with selected electrodes 24, 26. Hence, stimulation generator 64is coupled to electrodes 24, 26 via switch module 68 and conductorswithin leads 20.

In some examples, however, IMD 16 does not include switch module 68. Forinstance, rather than switching from a shared source, in some examplesof IMD 16, stimulation generator 64 includes individual current orvoltage sources for each electrode. These individual current or voltagesources may selectively drive corresponding electrodes.

Stimulation generator 64 may be a single channel or multi-channelstimulation generator. In particular, stimulation generator 64 may becapable of delivering, a single stimulation pulse, multiple stimulationpulses or a continuous signal at a given time via a single electrodecombination or multiple stimulation pulses at a given time via multipleelectrode combinations. In some examples, however, stimulation generator64 and switch module 68 may be configured to deliver multiple channelson a time-interleaved basis. For example, switch module 68 may serve totime divide the output of stimulation generator 64 across differentelectrode combinations at different times to deliver multiple programsor channels of stimulation energy to patient 12.

Sensing module 66, under the control of processor 60, is configured tosense bioelectrical brain signals of patient 12 via a selected subset ofelectrodes 24, 26 or with one or more electrodes 24, 26 and at least aportion of a conductive outer housing 34 of IMD 16, an electrode on anouter housing of IMD 16 or another reference. Processor 60 may controlswitch module 68 to electrically connect sensing module 66 to selectedelectrodes 24, 26. In this way, sensing module 66 may selectively sensebioelectrical brain signals with different combinations of electrodes24, 26 (and/or a reference other than an electrode 24, 26). Aspreviously described, processor 60 may monitor the efficacy of therapydelivery by IMD 16 via the sensed bioelectrical brain signals anddetermine whether the efficacy of therapy delivery has changed, and, inresponse, generate a notification (e.g., to patient 12 or patientcaretaker).

Although sensing module 66 is incorporated into a common housing 34 withstimulation generator 64 and processor 60 in FIG. 2, in other examples,sensing module 66 is in a separate outer housing from outer housing 34of IMD 16 and communicates with processor 60 via wired or wirelesscommunication techniques.

Telemetry module 70 is configured to support wireless communicationbetween IMD 16 and an external programmer 14 or another computing deviceunder the control of processor 60. Processor 60 of IMD 16 may receive,as updates to programs, values for various stimulation parameters suchas amplitude and electrode combination, from programmer 14 via telemetrymodule 70. The updates to the therapy programs may be stored withintherapy programs 74 portion of memory 62. Telemetry module 70 in IMD 16,as well as telemetry modules in other devices and systems describedherein, such as programmer 14, may accomplish communication by RFcommunication techniques. In addition, telemetry module 70 maycommunicate with external medical device programmer 14 via proximalinductive interaction of IMD 16 with programmer 14. Accordingly,telemetry module 70 may send information to external programmer 14 on acontinuous basis, at periodic intervals, or upon request from IMD 16 orprogrammer 14. For example, processor 60 may transmit brain stateinformation to programmer 14 via telemetry module 70.

Power source 72 delivers operating power to various components of IMD16. Power source 72 may include a small rechargeable or non-rechargeablebattery and a power generation circuit to produce the operating power.Recharging may be accomplished through proximal inductive interactionbetween an external charger and an inductive charging coil within IMD16. In some examples, power requirements may be small enough to allowIMD 16 to utilize patient motion and implement a kineticenergy-scavenging device to trickle charge a rechargeable battery. Inother examples, traditional batteries may be used for a limited periodof time.

As illustrated in FIG. 2, processor 60 includes frequency band phasedetector 78 and comparator 80. Frequency band phase detector 78 receivesthe bioelectrical brain signal from sensing module 66, and determinesthe phase of a frequency band of the sensed bioelectrical brain signal(e.g., a theta wave) using the example techniques described in thisdisclosure. In examples where frequency band phase detector 78 operateson digital samples of the signal, sensing module 66 may include ananalog-to-digital converter (ADC) that converts the analog brain signalinto a digital signal. For instance, the ADC of sensing module 66 maysample the signal at a sampling frequency, referred to as fsr, andoutput the digital samples to frequency band phase detector 78. Oneexample of the sampling frequency is 250 Hz, although other samplingrates are possible, such as at least at the Nyquist rate (e.g., twicethe frequency of the brain signal to be analyzed). In examples wherefrequency band phase detector 78 operates on the analog signal,analog-to-digital conversion may not be necessary, but may be useful forother components of processor 60.

Frequency band phase detector 78 outputs phase information indicative ofthe determined phase to comparator 80. Comparator 80 also receives athreshold phase 82. In some examples, comparator 80 determines whetherthe determined phase equals threshold phase 82. In response to adetermination that the determined phase equals threshold phase 82,processor 60 causes stimulation generator 64 to output stimulation vialeads 20A, 20B.

Threshold phase 82 is illustrated in a dashed box to indicate thatthreshold phase 82 is a stored phase value used for comparison purposes.In FIG. 2, a register of processor 60 may store threshold phase 82.However, it may be possible for memory 62 to store threshold phase 82.

The value of threshold phase 82 may be user selected during testing ormay be preset. For instance, as described above, to induce long-termpotentiation, IMD 16 may output electrical stimulation at a peak of ahippocampal theta wave. For this example, the value of threshold phase82 may be 90°, and when frequency band phase detector 78 determines, inreal-time, that the phase of the theta wave is 90°, comparator 80, undercontrol of processor 60, may cause stimulation generator 64 to outputstimulation. As another example, as described above, to induce long-termdepression (e.g., the opposite of potentiation in this context), IMD 16may output electrical stimulation at a trough of a hippocampal thetawave. For this example, the value of threshold phase 82 may be 270°, andwhen frequency band phase detector 78 determines, in real-time, that thephase of the theta wave is 270°, comparator 80, under control ofprocessor 60, may cause stimulation generator 64 to output stimulation.

It should be understood that frequency band phase detector 78 and/orcomparator 80 being part of processor 60 is provided for purposes ofillustration only and should not be considered limiting. In someexamples, frequency band phase detector 78 and/or comparator 80 may beexternal to processor 60, and be their own, independent components. Insome examples, frequency band phase detector 78 may be software orfirmware executing on processor 60, may be hardware components, or acombination of both software or firmware and hardware.

Also, the above example where comparator 80 causes stimulation generator64 to output stimulation when the phase, as determined by frequency bandphase detector 78, equals threshold phase 82 is merely one example andshould not be considered limiting. The phase, as determined by frequencyband phase detector 78, may be useful for other purposes as well, suchas diagnosis purposes. In general, IMD 16 or programmer 14, or possiblysome other device in a medical system may take some action based on thedetermined phase of the frequency band.

For instance, frequency band phase detector 78 may determine the phase,and processor 60 may utilize this information to estimate the timing ofwhen peaks or valleys in the signal are to occur. If processor 60determines that peaks or valleys in the signal did not occur at theestimated time, processor 60 may indicate as such, and externalprogrammer 14 or the clinician may utilize the information fordiagnosing the patient. There may be various other purposes of phasedetection, and the example described with respect to FIG. 2 is merelyone of the purposes.

Inclusion of frequency band phase detector 78 in processor 60 or, moregenerally, in IMD 16, may have minimal effect on the power consumptionand circuit space. For example, frequency band phase detector 78 mayconsume a maximum of 1 micro-amp. Also, frequency band phase detector 78may be implemented in a computational efficient manner, meaning thatadditional components in processor 60 to handle complex tasks may not beneeded.

In some examples, in addition to outputting the phase of the frequencyband to comparator 80, frequency band phase detector 78, via processor60, may output the phase value of the frequency band, via telemetrymodule 70, to programmer 14 for presentation. For instance, processor 60may output the sensed signal and the determined phase of the frequencyband as the signal is being sensed (e.g., output the sensed signal andthe determined phase of the frequency band in real-time). In someexamples, at least for the phase information being outputted to program14, processor 60 may add a fixed and known phase shift to the real-timephase information determined by frequency band phase detector 78. Thepurpose of the phase shift may be to align the π to −π transition alongan application-specific key phase point (e.g., trough or peak of an EEGtheta wave), which may aid in visual analysis.

FIG. 3 is a block diagram illustrating components of an examplefrequency band phase detector. For instance, FIG. 3 illustratesfrequency band phase detector 78 in greater detail. As illustrated,frequency band phase detector 78 includes notch filter 84, frequencycomponent phase detectors 86A-86C, and average 88. In the example ofFIG. 3, frequency band phase detector 78 receives a digital signal(e.g., an analog-to-digital converted signal), where one example of thedigital signal is an EEG waveform that is sampled at a sampling rate of250 Hz.

As illustrated, notch filter 84 of frequency band phase detector 78receives the signal (e.g., from sensing module 66). Notch filter 84 isan optional filter and may not be needed in every example. Notch filter84 may be configured to filter out frequencies that contribute noise tothe overall signal. For instance, as described in more detail, frequencycomponent phase detectors 86A-86C may function as a bandpass filter, andnotch filter 84 may function as a pre-filter to filter out noise fromthe signal before being bandpass filtered by frequency component phasedetectors 86A-86C.

As an example, in a bioelectrical brain signal, there may be a lot ofnoise in the area centered at 0 Hz. Notch filter 84 may filter out the 0Hz component from the signal. In one example, the equation of notchfilter 84 is:

(1−z ⁻¹)(1+z ⁻¹)/(1−r ₂ z ⁻¹),

where r₂ equals 0.90, the notch is at 0 Hz, and a zero at −1.

There may be other ways in which to pre-filter the signal (e.g., filterprior to frequency component phase detectors receiving the signal), andnotch filter 84 should not be considered limiting. Also, in the aboveexample, there is noise at 0 Hz. However, in other examples, where adifferent frequency includes particularly noisy signal components, notchfilter 84 may be configured to filter out such frequencies. If there arenot frequencies for which there is a lot of noise, notch filter 84 maynot be needed.

In general, notch filter 84 may be considered as applying pre-filteringprior to the phase detection. While it is possible for notch filter 84to add some phase delay, thereby reducing the accuracy of the phasedetection, the effect of the phase delay may be relatively small (e.g.,negligibly small), and in any case, can be accounted for in the phasecalculation.

For example, the phase delay as a function of frequency can becalculated for any pre-filter (e.g., for notch filter 84, in thisexample). As described in more detail, each one of frequency componentphase detectors 86A-86C may be configured to determine the phase forrespective frequency components. Also, the phase delay for each of thefrequency components may be different through notch filter 84.Accordingly, for each of frequency component phase detectors 86A-86C, aknown phase delay, which corresponds to the frequency component forwhich they are configured, resulting from notch filter 84, can be addedto account for the delay through notch filter 84. In one example,averager 88 may account for the delay through notch filter 84. In oneexample, frequency component phase detectors 86A-86C may account for thedelay through notch filter 84. There may be other ways in which toaccount for the delay through notch filter 84, and the techniques arenot limited to the above examples.

For bioelectrical brain signals, where the EEG theta band is ofinterest, the non-theta frequency content resembles 1/f noise.Accordingly, to eliminate the large noise content around 0 Hz, notchfilter 84 is applied at 0 Hz. The high frequency noise is lessened byadding a zero at −1 on the unit circle. Again, notch filter 84 may beoptional, or may be reconfigured to apply a notch at another frequencyif the frequency bands not of interest (e.g., non-theta frequencies)resemble different content than 1/f noise.

As illustrated, frequency band phase detector includes three frequencycomponent phase detectors 86A-8C. In some examples, there may be more orfewer frequency component phase detectors. Each of frequency componentphase detectors 86A-86C receives the output from notch filter 84. Eachone of frequency component phase detectors 86A-86C may be substantiallythe same, and can be configured for respective frequency components.

As illustrated, each one of frequency component phase detectors 86A-86Creceives three variables: f, r, and weight factor (wf), where f1, r1,and wf1 are for frequency component phase detector 86A, f2, r2, and wf2are for frequency component phase detector 86B, and f3, r3, and wf3 arefor frequency component phase detector 86C. In some examples, ratherthan receiving these variables, each one of frequency component phasedetectors 86A-86C may be pre-configured with set values for one or moreof f, r, or wf. To allow frequency component phase detectors 86A-86C tobe basic building blocks, in some examples, frequency component phasedetectors 86A-86C may receive the values for one or more of variables f,r, or wf so that frequency component phase detectors 86A-86C areconfigurable for the intended frequency band.

The variable “f” refers to the frequency component of the frequency bandfor which each one frequency component phase detectors 86A-86C are todetermine the phase. For example, for a theta wave with frequency bandof 4 Hz to 8 Hz, f1 may equal 4 Hz, f2 may equal 6 Hz, and f3 may equal8 Hz. In this example, frequency component phase detector 86A isconfigured to determine the phase for the 4 Hz frequency component ofthe signal, frequency component phase detector 86B is configured todetermine the phase for the 6 Hz frequency component of the signal, andfrequency component phase detector 86C is configured to determine thephase for the 8 Hz frequency component of the signal.

The variable “r” sets the rate of decay of the weighting of earliersamples. As described in more detail, the variable “r” sets a pole atthe decaying weighted filter described in FIG. 5. For example, themultiplicative factor that any previous sample is reduced on the nextcycle is “r.” As one example, if “r” equals 0.97, then the weighting ofthe every previous point used in the last calculation will be 0.97 timeswhat it was in the past. In effect, the larger the value of “r,” thebigger the time constant, the poorer the time resolution, and the betterthe frequency resolution. The smaller the “r,” the smaller the timeconstant, the better the time resolution, and the poorer the frequencyresolution. The value of “r” may be configurable based on the trade-offbetween time and frequency resolution.

In the examples described in this disclosure, the value of “r” is lessthan one. As one example, the value of r is 0.97 for each of r1, r2, andr3. The values r1, r2, and r3 may be the same values, in some examples,or different values, in some examples. In some examples, the value of rmay be greater than 0.8, and less than one, but the techniques shouldnot be considered limiting in this way.

The “wf” variable is used to determine the weight factor that is appliedto the phase information determined by each of frequency component phasedetectors 86A-86C for respective phases. For instance, conceptually, thedecaying weighting of earlier samples results in each of frequencycomponent phase detectors 86A-86C functioning as a resonator (e.g.,leaky resonator) around the frequency component defined by the variable“f.” For example, as illustrated and described in more detail withrespect to FIG. 5, each one of frequency component phase detectors86A-86C utilizes a weighting filter (e.g., decaying weighted filter 90of FIG. 5 described below) to implement the decaying weighting ofearlier samples.

In the frequency domain, the transfer function of the weighting filterof each of frequency component phase detectors 86A-86C appears like aGaussian curve. In the example illustrated in FIG. 3, the combination ofthree frequency component phase detectors 86A-86C can be considered as asummation of three Gaussian curves each centered around respectivefrequency components of 4 Hz, 6 Hz, and 8 Hz. The summation of threeGaussian-like curves each centered around respective frequencycomponents of 4 Hz, 6 Hz, and 8 Hz results in a bandpass filter transferfunction with a band of 4 Hz to 8 Hz.

The variable “wf” is used to control the contribution of theGaussian-like curves for each of the frequency components. For example,for the Gaussian-like curve of the 4 Hz component, the contribution offrequencies greater than 4 Hz sum with the Gaussian-like curve of the 6Hz component and sum with the contribution of frequencies less than 8 Hzfor the Gaussian-like curve of the 8 Hz, resulting in a peak in the 6 Hzcomponent. The variable “wf” is used to control such peaking.

In other words, for proper phase detection, it may be desirable for theweighting filters of each of frequency component phase detectors 86A-86Cto add together to form a bandpass filter with unity gain (e.g., samegain across 4 Hz to 8 Hz, with reduction in amplitude for signals lessthan 4 Hz and reduction in amplitude for signals greater than 8 Hz).However, without band weighting, the leaky resonator behavior isadditive, and there is not unity gain across the band. By selecting theappropriate values for wf1, wf2, and wf3, it is possible to control thecontribution of each of the leaky resonators so that there is nearlyunity gain across the frequency band.

With the appropriate values for wf1, wf2, and wf3, each one of frequencycomponent phase detectors 86A-86C may determine respective frequencyweights, identified as FREQUENCY WEIGHTS1-3 in FIG. 3. The “frequencyweights” and the “weighting of samples” (e.g., decaying weighting)should not be confused. The frequency weights define the amount thateach of the frequency components contributed to the final determinationof the phase of the frequency band. The weighting of samples refers tothe amount that each sample contributes to the determination of a phaseof the frequency component.

As illustrated, each one of frequency component phase detectors 86A-86Coutput phase information, identified as PHASE 1-3 in FIG. 3, of phasesof respective frequency components, and respective frequency weights.Averager 88 receives the phase information for respective frequencycomponents and frequency weights. Averager 88 may determine a weightedaverage to determine the phase of the frequency band. For instance,average 88 may implement the following equation:

Phase of Frequency Band=((phase1)(frequency weight1)+(phase2)(frequencyweight2)+(phase3)(frequency weight3))/(frequency weight1+frequencyweight2+frequency weight3).

The above equation may be implemented by averager 88 to determine thephase of the frequency band in one example. There may be other ways inwhich averager 88 may determine the phase of the frequency band. Forinstance, each of the frequency weights outputted by respectivefrequency component phase detectors 86A-86C may be considered as anamplitude. In this example, each corresponding frequency weight andphase may define a phasor, where the frequency weight is the amplitudeand the phase is the angle of the phasor (e.g., frequency weight1 andphase1 together define phasor1, frequency weight2 and phase2 togetherdefine phasor2, and frequency weight3 and phase3 together definephasor3).

In some examples, averager 88 may perform a vector sum of the phasorsand determine the angle of the total summation vector to determine thephase of the frequency band.

Phase of Frequency Band=angle(Σ^(n) _(k=1) A _(k)(cos θ_(k) +i sinθ_(k))).

In the above equation, A_(k) is the frequency weight outputted byrespective frequency component phase detectors 86A-86C (e.g., frequencyweight1−frequency weight3). Also, θ_(k) equals the phase outputs fromrespective frequency component phase detectors 86A-86C (e.g.,phase1−phase3).

The techniques for determining the phase of frequency band based onphasors may be considered as using the vector sum of the output phasorsfrom three frequency component phase detectors with different resonantfrequencies to estimate the real-time phase of a frequency band withinthe incoming EEG waveform. These techniques for determining the phase ofthe frequency based on phasors may be considered as a generalization ofthe equation for the simple weighted average of phase described above.For instance, in the absence of noise, when vectors share nearly thesame angle, the small angle approximation can be applied, reducing theequation of Phase of Frequency Band=angle(Σ^(n) _(k=1)A_(k)(cos θ_(k)+isin θ_(k))) to Phase of Frequency Band=((phase1)(frequencyweight1)+(phase2)(frequency weight2)+(phase3)(frequencyweight3))/(frequency weight1+frequency weight2+frequency weight3).

This generalization is useful as it allows an arbitrary filter to beconstructed that is applicable to any given frequency phase of a LPF orEEG band oscillator, such as the theta rhythm. This is because an LFPoscillation can vary within a larger frequency range that cannot beadequately tracked using only one of frequency component phase detectors86A-86C; for example, the so-called “theta band” has about a 4 Hz widevariation in frequency ranging, in some cases, from 4 Hz to 8 Hz.Without the constructed, idealized band, when the input frequency movesaway from peak resonance of a single resonator, the recent past isweighted less heavily than the more distance past, resulting in asluggish phase-change response. Furthermore, given that differentsubjects, brain states, or brain regions can exhibit differences intheta band frequency characteristics, one advantage of this method isthat the band pass shape can be optimized for patients and signal originby simple parametric adjustment.

It should be understood that a weighted average is not necessary inevery example. In such examples, the variable “wf” or the determinationof the frequency weights may also not be necessary.

In some examples, averager 88 may be configured with phase delayinformation of notch filter 84 for each of the respective frequencycomponents. It should be understood that even in examples where there isno notch filter 84, there may be some other components that add phasedelay, and averager 88 may be configured with such phase delayinformation for each of the respective frequency components. Averager 88may add (or subtract) the phase delay information for respectivefrequency components with respective ones of PHASE1-3. Averager 88 mayutilize the resulting respective values in the above equation, ratherthan PHASE1-3, to determine the phase of the frequency band.

FIG. 4A is a graphical diagram illustrating a constructed band withpre-filter for a collection of theta waves. In other words, FIG. 4Aillustrates an example bandpass structure for phase estimation of EEGtheta wave. The bandpass structure may be, in some cases, optimal for acollection of EEG theta waves. As described above, each one of frequencycomponent phase detectors 86A-86C may be considered as resonators forselecting their respective frequency components, and provide a Gaussianlike roll off.

As illustrated in FIG. 4A, for frequencies above 8 Hz, the roll offappears Gaussian, and is the result of the summation of the roll offfrom each of frequency component phase detectors 86A-86C for respectivefrequency components of 4 Hz, 6 Hz, and 8 Hz. The roll off, forfrequencies less than 4 Hz, does not appear Gaussian because of notchfilter 84.

Also, as illustrated in FIG. 4A, over the 4 Hz to 8 Hz band, the gain isapproximately unity, with the three ripple peaks corresponding to therespective frequency components of 4 Hz, 6 Hz, and 8 Hz. In someexamples, the amplitude of the ripple peaks may be controlled by the“wf” variable described above.

FIG. 4B is another graphical diagram illustrating a constructed bandwith pre-filter for a collection of theta waves. FIG. 4B is similar toFIG. 4A expect that FIG. 4B is illustrated on a log-scale and FIG. 4A isillustrated on a linear-scale. Also, the weighting of each one offrequency component phase detectors 86A-86C (e.g., the “wf” variable foreach of frequency component phase detectors 86A-86C) may be different inFIGS. 4A and 4B. In FIG. 4B, the weighting for 4 Hz, 6 Hz, and 8 Hzresonators (e.g., frequency component phase detectors 86A, 86B, and 86C,respectively) is 1.98, 1.00, and 1.70, respectively.

The example illustrated in FIG. 4B may function better for 1/f noise ofthe brain because the band pass amplitude is less at 4 Hz than 8 Hz. Theexample illustrated in FIG. 4A may perform better in a white noiseenvironment. In general, there may not be much difference in theperformance between the examples illustrated in FIGS. 4A and 4B, and theexample illustrated in FIG. 4B is directed more towards the specificexample of measuring the phase of the theta wave in the brain which hasmore 1/f noise than general white noise. In other words, the techniquesdescribed in this disclosure may be optimized for the specific noisecharacterized for the system in which the techniques are beingimplemented (e.g., optimized to reduce the 1/f noise in the brain oroptimized if there is white noise for another system, either in thebrain or otherwise).

FIG. 5 is a block diagram illustrating an example of a frequencycomponent phase detector. FIG. 5 illustrates a generic example offrequency component phase detector 86. For instance, frequency componentphase detectors 86A-86C may be substantially the same as frequencycomponent phase detector 86 illustrated in FIG. 5. Frequency componentphase detector 86 may be considered as a real-time Fourier transform(RTFT) block, and may be a leaky resonator-based RTFT implementationthat is computationally efficient.

As illustrated, decaying weighted filter 90 receives an input signal. Insome examples, the input signal may be the output of notch filter 84,and in some examples, may be the sampled signal (e.g., sampledbioelectrical brain signal). In either example, the input signal may bedigital signal that has been sampled at a sampling rate of fsr (e.g.,250 Hz). In analog implementation, the input signal to decaying weightedfilter 90 may be the analog signal (or an analog filtered version of theanalog signal). For ease of description, the example illustrated in FIG.5 is described with respect to a digital implementation, but thetechniques may be extended to analog implementations as well. Decayingweighted filter 90 may implement the following transfer function tofilter the input signal in such a way that present and more recentsamples of the input signal are weighted more heavily in determining thephase of the frequency component than earlier samples of the inputsignal. The transfer function of decaying weighted filter 90 may be:

H(z)=1/(1−re^(+jw) z ⁻¹)  (equation 1).

In equation 1, “r” equals the decaying weighting factor that determinesthe rate of decay of the weighting applied to the previous samples asdescribed above, and “w” equals 2*π*(f/f_(sr)), where “f” equals thefrequency component as described above.

In general, the transfer function of decaying weighted filter 90 may beconsidered as correlation equation in which the input signal iscorrelated with the frequency of the frequency component for whichfrequency component phase detector is configured, in which more recentsamples of the signal are weighted more heavily than earlier portions ofthe signal. The transfer function of decaying weighted filter 90 (e.g.,H(z)) may be utilized because it provides for an exponentially decayingweighting of earlier samples, as described in more detail below, andgenerally because such a transfer function can be implemented as adigital filter in an computationally efficient manner. However, thetransfer function in equation 1 should not be considered limiting. Insome examples, other transfer functions in which earlier samples of theinput signal are weighed less than present and more recent samples ofthe input signal are possible, such as transfer functions that implementa linearly decaying weighting, a step-wise decaying weighting, or otherpossible decaying weighting techniques.

One example way in which to implement an exponentially decayingweighting function is with a discrete time Fourier transform withexponentially decaying weighting. The Fourier transform may beconsidered as a correlation with a basis set that includes sine andcosine waves with a frequency equal to the frequency of the frequencycomponent for which frequency component phase detector 86 is configured,and may be referred to as modulating the input signal. However, a basisset of sine and cosine waves is not necessary, and decaying weightedfilter 90 may correlate the input signal with a frequency equal to thefrequency component for which frequency component phase detector 86 isconfigured with a basis set different than sine and cosine waves (e.g.,triangular waves). In these examples, the weighting of present andrecent samples may be more heavy than earlier samples as part of thecorrelation calculation (e.g., predominantly decreasing weighting ofportions of the signal).

The equation for the discrete time Fourier transform with exponentiallydecaying weighting is:

$\begin{matrix}{{X(w)} = {\sum\limits_{n = {- \inf}}^{0}{r^{- n}e^{- {jwn}}{{x(n)}.}}}} & \left( {{equation}\mspace{14mu} 2} \right)\end{matrix}$

In equation 2, x(n) represents the samples of the signal. The variables“r” and “w” are the same as above with respect to equation 1, where “r”is less than one. The weighting function of equation 2 may function wellfor its ideal predictive properties and computationally efficientimplementation.

Mathematically, equation 2 can be rewritten as a geometric series, whichis the same as equation 1 (i.e., H(z)=1/(1−re^(+jw)z⁻¹)). In this way,decaying weighted filter 90 implements a weighted Fourier transform at wequals 2*it*f/fsr to weigh earlier samples of the signal less heavilythan present and more recent samples of the signal.

Multiplying the numerator and denominator of equation 2 by the complexconjugate of the denominator yields:

H(z)=(1−re^(−jw) z ⁻¹)/(1−2r cos(w)z ⁻¹ +r ² z ⁻²)  (equation 3).

The denominator of equation 3 is the transfer function of a leakyresonator formed by poles located at radius “r” and angle “w” and “−w”on the unit circle. The numerator of equation 3 converts the output ofthe leaky resonator to a complex frequency component. For this reason,frequency component phase detector 86 may be considered as a leakyresonator building block, where one or more leaky resonator buildingblocks (e.g., frequency component phase detectors 86A-86C) together areused to determine the real-time phase of the frequency band, asillustrated in FIG. 3 and described above with respect to FIG. 3.

In the example illustrated in FIG. 5, equations 1-3 may be considered ascorrelating the input signal with frequency component based on apredominantly decreasing weighting of the input signal. For instance,with a Fourier transform the correlation may be considered as modulationin which the input signal is modulated by cos((frequencycomponent)*t)+/−j sin((frequency component)*t). However, with a weightedFourier transform (e.g., decaying weighting), earlier portions of theinput signal are weighed less than more recent portions. In thisexample, the cosine and sine waves are examples of a basis set, butthere may be other possible basis sets. As described above, a basis setincludes mathematical functions that can be used to represent a signalof interest (e.g., sine and cosine waves can be used to represent atheta wave, but other possible waves may also be used to represent thetheta wave, such as triangular waveforms).

As illustrated in FIG. 5, the output of decaying weighted filter 90 isreferred to as a filtered signal, and is a complex phasor: X+jY. Theamplitude of the output of decaying weighted filter 90 (e.g., theamplitude of the filtered signal) is based on the magnitude of X+jY(i.e., sqrt(X²+Y²)). The phase of the output of decaying weighted filter90 (e.g., the filtered signal) is given by the angle of X+jY (i.e.,arc-tangent of Y/X). For example, phase determination unit 94A receivesthe output from decaying weighted filter 90, and determines the phase ofthe filtered signal outputted by decaying weighted filter 90 bydetermining (a tan(Y/X). The determined phase of the output of decayingweighted filter 90, as determined by phase determination unit 94A isreferred to as θ₁.

In FIG. 5, θ₁ represents the phase of the frequency component at theinput of the filter plus any phase delay added by decaying weightedfilter 90. This phase delay added by decaying weighted filter 90 isreferred to as an unaccounted for phase delay or, more simply, as aphase error. In this disclosure, the determined phase of the filteredsignal includes the phase of the frequency component and a phase error.In other words, θ₁ is a noisy estimate of the phase of the frequencycomponent because it includes the actual phase of the frequencycomponent and a phase error.

In general, the unaccounted for phase delay represents the phase delayadded by decaying weighted filter 90, where the amount of phase delaydecaying weighted filter 90 adds to each frequency of the input signalmay be different. For instance, in a discrete time Fourier transformwithout exponentially decaying weighting, the phases of all frequencycomponents of the signal change by the exact same amount. However,although decaying weighted filter 90 attenuates frequencies other thanthe frequency for which frequency component phase detector 86 isconfigured, these other frequencies are not completely removed, and theamount by which the phase changes, for some of these other frequencies,varies. In other words, the phase delay added by decaying weightedfilter 90 is not the same for each of the frequency components of theinput signal.

Frequency component phase detector 86 may be configured to implement aself-correlation (or self-modulation) technique to measure theunaccounted for phase delay and subtract the unaccounted for phase delayfrom the phase determined by phase determination unit 94A to determinean initial estimate of the phase of the frequency component. Forexample, frequency component phase detector 86 may determine theunaccounted for phase error and phase delay in the filtered signaloutputted by decaying weighted filter 90 by comparing it with the inputsignal, where such comparison is performed by correlating (in someexamples, modulating where sine and cosine waves are used) the inputsignal with the complex frequency component phasor at the output of theweighted Fourier transform performed by decaying weighted filter 90(e.g., the filtered output signal represented by X+jY). In other words,frequency component phase detector 86 may determine a phase of thefiltered signal, determine the phase error, and subtract the determinedphase error from the phase of the filtered signal to determine aninitial phase of the frequency component.

For example, correlation unit 91 may correlate the input, receivedsignal with the filtered signal (represented, in FIG. 5, by the complexoutput phasor X+jY) outputted by decaying weighted filter 90. In thismanner, correlation unit 91 may correlate the input signal to thebaseband with the unaccounted for phase delay resulting from decayingweighted filter 90 given by the angle of the complex baseband.

Integrator 92, also referred to as a leaky integrator, receives theoutput of correlation unit 91, and low pass filters the signal to removehigh frequency content (e.g., isolating the output of correlation unit91 from high frequency content). For example, integrator 92 may filter asignal resulting from the correlation to generate a filtered correlatedsignal. Integrator 92 may implement the following transfer function tofilter the output of modulation unit 91:

H _(int)(z)=1/(1−rz ⁻¹)  (equation 4).

In equation 4, integrator 92 uses the same temporal weighting asequation 1. In other words, the variable “r” in equation 4 is the sameas the variable “r” in equation 1.

As illustrated in FIG. 5, the output of integrator 92 (e.g., thefiltered correlation signal) is represented by the phasor: X₂+jY₂. Phasedetermination unit 94B may determine the phase of the filteredcorrelated signal (e.g., the output of integrator 92) by determining thearc-tangent of Y₂/X₂. For example, the unaccounted for phase error phasedelay (e.g., phase error) is determined by the angle of a low frequencypass version of the complex signal resulting from the modulation. Theoutput of phase determination unit 94B is the unaccounted for phasedelay (e.g., phase error), referred to as θ₂. Subtraction unit 95 maysubtract the output of phase determination unit 94B from the output ofphase determination unit 94A (e.g., θ₁−θ₂), referred to as θ. In thisexample, θ is an initial estimate phase of the frequency component.

In the example of FIG. 5, frequency changes and corresponding phaseshifts on the input signal, not yet reflected in the output of equation1, are directly fed into the phase measurement performed by themodulation and equation 4, correcting for this shift as part of thephase delay measurement. In this example, the exponential decay in theweighting of past information is maintained in estimating the phase,even with the inclusion of integrator 92.

In this sense, although the disclosure focuses on real-time phaseestimation of sinusoids the concept is extensible to other periodicbasis sets as well, perhaps more representative of the underlyingsignal, like triangular waveforms. In this disclosure, a weightedFourier transform is replaced by two (or more) correlation operationsagainst phase shifted basis elements where the relative amplitudesresulting from the correlation operations are used to determine thenoisy estimate of phase (e.g., phase of the filtered output signal thatdecaying weighting filter 90 outputs). The non-linear phase delayresulting from the asymmetric correlation window of decaying weightingfilter 90 is corrected for by performing a correlation by correlationunit 91 of the generalized phasor (e.g., X+jY) resulting from this noisyestimate (e.g., phase of the filtered output signal from decayingweighting filter 90) against the input signal. It should be noted thatwithout the convenient properties of a sinusoidal basis set this moregeneral approach may be more accurate, but may not be as computationallyefficient.

In some examples, the output of decaying weighted filter 90 may includehigh frequency components that result from decaying weighted filter 90applying a discrete time Fourier transform. For example, the techniquesdescribed in this disclosure may function well when the decay of thewindow of the Fourier transform is significant compared to the period ofthe frequency band (e.g., as described below, in some examples a factorQ is needed, which is based on the decay variable “r” and the frequencyof the input signal and the frequency component). However, a Fouriertransform modulates the desired frequency (e.g., the frequency componentto which frequency component phase detector 86 is configured) tobaseband with e^(−jwt) equals cos(wn)−j*sin(wn), but also creates anup-modulated signal content at twice the modulation frequency. Thelow-pass filtering capabilities of decaying weighted filter 90 (e.g.,via the decaying window function) will reduce the amplitude of the highfrequency up-modulated signal; however, such low-pass filtering does notremove the high frequency up-modulated signal completely.

For instance, assume that frequency component phase detector 86 isconfigured for the 6 Hz frequency component. In this example, decayingweighted filter 90 may produce content at 12 Hz due to the up-modulationresulting from the Fourier transform. Although decaying weighted filter90 may reduce the amplitude of the content at 12 Hz, there may be limitsto how much decaying weighted filter 90 can reduce the amplitude of thecontent at 12 Hz. For low-frequency systems, such as system for thetawaves, the up-modulated signal content is at a frequency sufficientlyclose to the frequency component (e.g., 12 Hz is close to 6 Hz) that thelow-pass filtering capabilities of decaying weighted filter 90 may beinsufficient to remove the up-modulated signal content.

As illustrated in FIG. 5, frequency component phase detector 86 mayinclude correction unit 96. Correction unit 96 may be configured toremove the effects of the signal content from the up-modulated signal.

There may be various ways for correction unit 96 to remove the effectsof the signal content from the up-modulated signal. One example way isusing a notch filter to the initial estimate phase of the frequencycomponent. Another example way is using an analytical correction term tothe initial estimate phase of the frequency component. There may beother ways in which to remove the effect of the up-modulated signal, andthe techniques should not be considered limited to the above examples.

The notch filter to remove the up-modulated signal may function well inexamples where there is large separation between the up-modulated signaland the frequency component. For low-frequency cases, such as thetawave, there may not be sufficient separation between the up-modulatedsignal and frequency component. However, it may still be possible toutilize a notch filter even for low frequency applications.

In the examples described in this disclosure, correction unit 96 mayimplement an analytical correction term, and output phase correctedvalue (e.g., θ_(corrected)) represents the phase of the frequencycomponent for which frequency component phase detector 86 is configured.In general, the output of correction unit 96 may be a function of θ and(f_(sr)/f)*(1−r). As one example, correction unit 96 may implement thefollowing equation:

θ_(corrected) =θ−Q*cos(2*(θ+Q))  (equation 5).

In equation 5, “Q” equals k*(fsr/f)*(1−r). The variable “k” is aconstant, “fsr” is the sampling frequency, “f” is the resonatorfrequency (e.g., the frequency component for which frequency componentphase detector 86 is configured), and “r” is radius of the resonatorpoles (e.g., the value that determines the rate of decay of theweighting).

However, equation 5 is one example of how correction unit 96 may removethe effects of the signal content from the up-modulated signal. In someexamples, correction unit 96 may implement the following equation:

θ_(corrected) =θ−Q*cos(2*(θ+Q))+O(θ)  (equation 5′).

In equation 5′, “Q” is the same as in equation 5. The variable “O(θ)” isan error in the correction step. The model may be accurate for Q<<1. Forinstances where Q is larger, the correction step of correction unit 96may be implemented using a piece-wise-linear model based on a lookuptable formed by observing phase error as a function of input phase atthe resonant frequency. For the theta waves described in thisdisclosure, it may be possible to neglect O(θ).

The examples illustrated in FIGS. 3 and 5 may result in a bandpass shapethat is more general than the leaky resonator bandpass shape outputtedonly by decaying weighted filter 90. For example, as indicated in FIG. 3and illustrated in FIGS. 4A and 4B, the resonator frequencies of each offrequency component phase detectors 86A-86C summed together provides thea constructed band with a more general bandpass shape without affectingthe temporal weighting of the past.

Also, as described above with respect to FIG. 3, the real-time phase ofthe frequency band may be a weighted phase output average of the outputsof each of the leaky resonators (e.g., outputs of each of frequencycomponent phase detectors 86A-86C). As illustrated in FIG. 5, thefrequency weight is based on a product, by multiplier 99, of the weightfactor (e.g., “wf” used to form the more ideal band of creating unitygain across the band, as described above with respect to FIG. 3 andillustrated in FIGS. 4A and 4B) and the amplitude of the output ofdecaying weighted filter 90 (e.g., leaky resonator output amplitude).

The amplitude of the output of the leaky resonator (e.g., output ofdecaying weighted filter 90) is the magnitude of the phasor output asthe output of the leaky resonator is low pass filtered. For example, asillustrated in FIG. 5, low pass filter 98 receives the output fromdecaying weighted filter 90 (e.g., the filtered signal represented byphasor X+jY) and low-pass filters the output with a single pole filterthat is multiplied by the magnitude of the complex phasor. Low passfilter 98 may be configured to implement the following transferfunction:

sqrt(X ² +Y ²)/(1−rz ⁻¹).

In some examples, passing the output of decaying weighted filter 90through low pass filter 98, which implements the above transferfunction, may be useful in measuring the phase of an EEG, such as thetheta wave (but may not be needed for other types of signals or otherfrequency bands). In some cases, an EEG oscillation may vary within afrequency range (e.g., 4 Hz to 8 Hz for the theta wave). Without theconstructed idealized frequency band based on the weight factor, asdescribed above, with respect to FIGS. 3 and 4, when the input frequencymoves away from peak resonance, the recent past is weighted less heavilythan the more distant past, resulting in a sluggish phase-changeresponse. The bandpass shape may be optimized for patients and signalorigin by simple parametric adjustment. For example, amplitude gain isless when frequency is off of the resonance (e.g., off of the respectivefrequencies for which each of frequency component phase detectors86A-86C are configured. Accordingly, when the input signal is away fromresonance, the input signal may not contribute as much to thecalculation compared to earlier portions of the signal, and frequencyband phase detector 78 may be slower to response to recent changes inthe signal.

Accordingly, in the example illustrated in FIG. 5, decaying weightedfilter 90 filters the input signal by correlating (e.g., comparing) theinput signal to one or more (e.g., two or more) different phase shifted(e.g., delayed) versions of a representative pattern. For example,decaying weighted filter 90 utilized sine and cosine waves whosefrequency is the frequency component to correlate the input signal. Therelative correlation of the input signal with the representativepatterns may determine the pattern's phase (e.g., a noisy phase of thefrequency component that includes the phase of the frequency componentand a phase error). The phase error is due to the differing delays offrequencies through decaying weighted filter 90. In this example, morerecent past portions of the signals is use more heavily than the moredistant past in estimating the phase because the more recent pastportions are more indicative of the present phase.

The differing delays of frequencies through decaying weighted filter 90(e.g., differing delays of the different frequency components of thesignal) is corrected by correlating the input signal to this noisy phaseestimate (e.g., θ₁) of the representative pattern (and a delayedversion) thereby measuring the filter delay (e.g., phase error) used toobtain the actual phase from this noisy phase estimate. For example,correlation unit 91 correlates the input signal with the output ofdecaying weighted filter 90, and the output of correlation unit 91, andin some examples, after filtering through integrator 92 is a signalwhose phase is equal to the phase error (e.g., θ₂). Subtractor 95subtracts θ₂ from θ₁ to determine an initial estimate of the phase ofthe frequency component, and correction unit 96 removes up-modulatedportion of the filtered signal to output the phase of the frequencycomponent.

In this disclosure, one possible representative pattern is cosine wherethe above approach can be referred to as a Fourier transform withpredominantly decreasing weighting of the past where the filter delay(e.g., phase error) can be accounted for by correlating the input signalwith the Fourier transform's result (e.g., via correlation unit 91),obtaining the actual real-time phase. The techniques described in thisdisclosure may be replicated and combined over a wider distribution ofrepresentative patterns encompassing a broader range of input signalcomponents.

FIG. 6 is a flowchart illustrating a method in accordance with one ormore example techniques described in this disclosure. As illustrated inFIG. 6, one or more frequency component phase detectors (e.g., frequencycomponent phase detectors 86A-86C) may determine phases for each of oneor more frequency components of a frequency band of a first signal(e.g., 4 Hz, 6 Hz, and 8 Hz of a theta wave of a bioelectrical brainsignal), where determining the phases for each of the one or morefrequency components of the frequency band of the first signal includesweighting present and more recent portions of the first signal moreheavily than earlier portions of the signal (100). In some examples, thefirst signal may be generated from a second signal (e.g., notch filter84 may receive the second signal, which is a sensed signal, andpre-filter the second signal to generate the first signal). There may beother ways in which the second signal (e.g., sensed signal) ispre-filtered, and the disclosure is not limited to notch filter 84pre-filtering. In some examples, where notch filter 84 is not utilizedor there is no other pre-filtering, the second signal may be the same asthe first signal (e.g., the frequency component phase detectors 86A-86Creceive the sensed signal without pre-filtering).

Each one of frequency component phase detectors 86A-86C may determinephases for respective frequency components of the first signal bycorrelating the first signal with respective frequency components of thefrequency band of the first signal by weighting present and more recentportions of the first signal more heavily than earlier portions of thefirst signal. For example, each one of frequency component phasedetectors 86A-86C may correlate the first signal (e.g., one outputted bynotch filter 84 in examples where notch filter 84 is used) withwaveforms of a periodic basis set (e.g., sine and cosine waves as usedin a Fourier transform) with a predominantly decaying weighting of thefirst signal.

Frequency band phase detector 78 may determine a phase of the frequencyband of the second signal used to generate the first signal based on thedetermined phases for each of the one or more frequency components(102). For example, averager 88 may determine a weighted average basedon a frequency weight for each respective frequency component and thephase for each respective frequency component, and the phase of thefrequency band may equal the result of the weighted average. In someexamples, averager 88 or each one of frequency component phase detectors86A-86C may add or subtract respective phase delays, caused by thepre-filtering (e.g., by notch filter 84), for respective frequencycomponents to the determined phases for each of the one or morefrequency components of the frequency band of the first signal. Averager88 may determine the phase of the frequency band of the second signalbased on the result of the adding or subtracting. For example, averager88 may determine a weighted average based on a frequency weight for eachrespective frequency component and the phase, resulting from the addingor subtracting of respective phase delays, for each respective frequencycomponent, and the phase of the frequency band may equal the result ofthe weighted average.

FIG. 7 is a flowchart illustrating a method in accordance with one ormore example techniques described in this disclosure. As illustrated inFIG. 7, frequency band phase detector 78 may receive a first signalgenerated from a second signal (104). In one example, the second signalmay be a sensed signal that is pre-filtered (e.g., by notch filter 84)to generate the first signal. However, there may be other ways in whichthe second signal is pre-filtered (including the case where there isadded delay from the traveling of the second signal on a circuit). Inone example, the first signal and the second signal may be the samesignal (e.g., where notch filter 84 or other pre-filtering is notemployed). This second signal includes a frequency band, which includesone or more frequency components (e.g., the second signal is a sensedbrain signal that includes the theta frequency band, which includes oneor more frequency components such as 4 Hz, 6 Hz, and 8 Hz).

At least one frequency component phase detector 86A-86C may correlatethe first signal with a frequency component of the frequency band of thesecond signal by predominately (e.g., generally) decreasing weighting ofpast portions (e.g., samples) of the first signal, where predominatelydecreasing weighting of past portions of the first signal includespredominately weighting present and more recent portions of the firstsignal more heavily than earlier portions of the first signal (106). Thedecreasing weighting results in portions of the first signal that arecloser in time to the point of the second signal for which the phase isbeing determined having greater effect in determining the phase than theeffect of portions of the first signal that are further away in time tothe point of the second signal for which the phase is being determined.Such decreasing weighting may be beneficial because more recent samplesare more predictive of the phase than less recent samples, and if allsamples were equally weighted the less predictive samples wouldcontribute to determining the phase as much as the more predictivesamples, resulting in a less accurate phase determination. By weightingmore predictive samples more heavily, the techniques may more accuratelydetermine phase.

In one example, correlating the first signal with the frequencycomponent of the frequency band of the second signal by predominantlydecreasing weighting of past portions of the first signal includescorrelating the first signal with one or more waveforms of a periodicbasis set. The frequency of the waveforms of the periodic basis set isthe frequency component. As one example, the waveforms of the periodicbasis set include a sine wave and a cosine wave. For instance,correlating the first signal with the frequency component of thefrequency band of the second signal by predominantly decreasingweighting of past portions of the first signal includes Fouriertransforming the first signal with an exponentially decreasing weightingof past portions of the first signal.

At least one frequency component phase detector 86A-86C may determine aphase of the frequency component based on a filtered signal outputtedfrom the correlation (108). For example, the output of decaying weightedfilter 90 (represented as a complex phasor output X+jY) is a filteredsignal, and frequency component phase detector 86 may determine thephase of the frequency component based on the output of decayingweighted filter 90. Phase determination 94A may determine a phase of thefiltered signal outputted from decaying weighted filter 90 (e.g., atan(Y/X). The phase of the filtered signal is a noisy estimate of thephase because the phase of the filtered signal includes the phase of thefrequency component and a phase error. The phase error includes theunaccounted for phase delay which varies for each of the frequencies inthe signal and the phase delay of the frequency component caused bydecaying weighted filter 90.

Frequency component phase detector 86 may determine the phase error, andsubtract, via subtractor 95, the determined phase error, via phasedetermination unit 94B, from the phase of the filtered signal, via phasedetermination unit 94A, to determine an initial phase of the frequencycomponent. Correction unit 96 may apply at least one of a notch filteror a correction term to the initial phase of the frequency component,and the result may be the phase of the frequency component. In thismanner, frequency component phase detector 86 may determine the phase ofthe frequency component based on the application of at least one of thenotch filter or the correction term to the initial phase of thefrequency component.

There may be various ways in which frequency component phase detector 86may determine the phase error. As one example, frequency component phasedetector 86 may implement a self-correlation (self-modulation) scheme.For instance, correlation unit 91 may correlate the first signal (e.g.,the received signal) with the filtered signal (e.g., the output ofdecaying weighted filter 90). Integrator 92 may low-pass filter a signalresulting from the correlation (e.g., low-pass filter the output ofcorrelation unit 91) to generate a filtered correlated signal,represented as the complex phasor X₂+jY₂. Phase determination unit 94Bmay determine a phase of the filtered correlated signal. In thisexample, the phase error may be the determined phase of the filteredcorrelated signal.

Frequency band phase detector 78 may determine a phase of the frequencyband based on the determined phase of the frequency component (110). Forexample, averager 88 may receive the phase for each of the respectivefrequency components from respective frequency component phase detectors86A-86C. Averager 88 may determine a weighted average of the receivedphases to determine the phase of the frequency band.

In examples where there is pre-filtering of the second signal (e.g.,sensed signal) to generate the first signal that is received byfrequency component phase detectors 86A-86C, the pre-filtering may causea phase delay for each respective frequency component, and the phasedelay may not be uniform (e.g., may be different for each frequencycomponent). In some examples, averager 88 may add or subtract a phasedelay caused by generating the first signal from the second signal tothe determined phase of the frequency component. However, rather thanaverager 88 adding or subtracting the phase delay, respective ones offrequency component phase detectors 86A-86C may add or subtract thisphase delay (or some combination of both averager 88 and frequencycomponent phase detectors 86A-86C). Averager 88 may determine the phaseof the frequency band based on the result of the adding or subtracting.For example, averager 88 may determine the weighted average on theresult of the adding or subtracting to determine the phase of thefrequency band.

In some examples, in addition to the respective phases, each offrequency component phase detectors may be configured to determinerespective frequency weights. The frequency weights may be based on aweight factor multiplied by a low pass filtered output of decayingweighted filter 90 multiplied by the magnitude of the output of decayingweighted filter 90. For instance, the amplitude of the filtered signal(e.g., the amplitude of the output of decaying weighted filter 90) isdetermined by calculating the magnitude of the filtered signal (e.g.,sqrt (X²+Y²)) and passing it through a single pole low pass filter(e.g., low pass filter 98). Multiplier 99 multiples the weight factorwith the output of low pass filter 98. In such examples, averager 88 maybe configured to determine the phase of the frequency band based on aweighted average of the determined phases (or the phases resulting fromthe adding or subtracting of respective phase delays from pre-filtering)and frequency weights of respective frequency components.

The output of frequency band phase detector 78 is the phase of thefrequency band. The phase of the frequency band may be used for variouspurposes. As one example, IMD 16 may deliver therapy based on thedetermined phase of the frequency band. For example, processor 60 mayinstruct therapy module 65 to deliver therapy based on the determinedphase of the frequency band. As another example, IMD 16 may determineinformation used to diagnose based on the determined phase of thefrequency band.

FIG. 8 is a functional block diagram illustrating components of anexample medical device programmer 14 (FIG. 1). Programmer 14 includesprocessor 112, memory 114, telemetry module 116, user interface 118, andpower source 120. Processor 112 controls user interface 118 andtelemetry module 116, and stores and retrieves information andinstructions to and from memory 114. Programmer 14 may be configured foruse as a clinician programmer or a patient programmer. Processor 112 maycomprise any combination of one or more processors including one or moremicroprocessors, DSPs, ASICs, FPGAs, or other equivalent integrated ordiscrete logic circuitry. Accordingly, processor 112 may include anysuitable structure, whether in hardware, software, firmware, or anycombination thereof, to perform the functions ascribed herein toprocessor 112.

A user, such as a clinician or patient 12, may interact with programmer14 through user interface 118. User interface 118 includes a display(not shown), such as a LCD or LED display or other type of screen, withwhich processor 112 may present information related to the therapy, apatient condition detected by programmer 14 or IMD 16 based on afrequency domain characteristic of a sensed bioelectrical brain signal,or electrical signals sensed via a plurality of sense electrodecombinations. In addition, user interface 118 may include an inputmechanism to receive input from the user. The input mechanisms mayinclude, for example, buttons, a keypad (e.g., an alphanumeric keypad),a peripheral pointing device or another input mechanism that allows theuser to navigate through user interfaces presented by processor 112 ofprogrammer 14 and provide input.

If programmer 14 includes buttons and a keypad, the buttons may bededicated to performing a certain function (i.e., a power button), orthe buttons and the keypad may be soft keys that change functiondepending upon the section of the user interface currently viewed by theuser. In addition, or instead, the screen (not shown) of programmer 14may be a touch screen that allows the user to provide input directly tothe user interface shown on the display. The user may use a stylus ortheir finger to provide input to the display. In other examples, userinterface 118 also includes audio circuitry for providing audiblenotifications, instructions or other sounds to patient 12, receivingvoice commands from patient 12, which may be useful if patient 12 haslimited motor functions, or both. Patient 12, a clinician or anotheruser may also interact with programmer 14 to manually select therapyprograms, generate new therapy programs, modify therapy programs throughindividual or global adjustments, and transmit the new programs to IMD16.

In some examples, at least some of the control of therapy delivery byIMD 16 may be implemented by processor 112 of programmer 14. Forexample, in some examples, processor 112 may receive sensed brain signalinformation from IMD 16 or from a sensing module that is separate fromIMD 16. The separate sensing module may, but need not be, implantedwithin patient 12. Brain signal information may include, for example, araw bioelectrical brain signal, parameterized bioelectrical brainsignal, or any other suitable information indicative of a bioelectricalbrain signal sensed by sensing module 66. For example, processor 112 mayreceive phase information indicating the phase of the frequency band ofinterest, and may utilize the information for purposes of diagnosingpatient 12 or may utilize the information to present the instantaneousphase of the frequency band. In some examples, rather than IMD 16,processor 112 may add a known phase shift to align the phase with thebioelectrical brain signal.

Memory 114 may include instructions for operating user interface 118 andtelemetry module 116, and for managing power source 120. In someexamples, memory 114 may also store any therapy data retrieved from IMD16 during the course of therapy, sensed bioelectrical brain signals, andthe like. In some instances, the clinician may use this therapy data todetermine the progression of the patient condition in order to planfuture treatment for the movement disorder (or other patient condition)of patient 12. Memory 114 may include any volatile or nonvolatilememory, such as RAM, ROM, EEPROM or flash memory.

Memory 114 may also include a removable memory portion that may be usedto provide memory updates or increases in memory capacities. A removablememory may also allow sensitive patient data to be removed beforeprogrammer 14 is used by a different patient.

Wireless telemetry in programmer 14 may be accomplished by RFcommunication or proximal inductive interaction of external programmer14 with IMD 16. This wireless communication is possible through the useof telemetry module 116. Accordingly, telemetry module 116 may besimilar to the telemetry module contained within IMD 16. In someexamples, programmer 14 may be capable of infrared communication ordirect communication through a wired connection. In this manner, otherexternal devices may be capable of communicating with programmer 14without needing to establish a secure wireless connection.

Power source 120 is configured to deliver operating power to thecomponents of programmer 14. Power source 120 may include a battery anda power generation circuit to produce the operating power. In someexamples, the battery may be rechargeable to allow extended operation.Recharging may be accomplished by electrically coupling power source 120to a cradle or plug that is connected to an alternating current (AC)outlet. In addition, recharging may be accomplished through proximalinductive interaction between an external charger and an inductivecharging coil within programmer 14. In other examples, traditionalbatteries (e.g., nickel cadmium or lithium ion batteries) may be used.In addition, programmer 14 may be directly coupled to an alternatingcurrent outlet to operate.

In some examples, it may be possible for programmer 14 to perform thephase detection techniques of IMD 16. For example, IMD 16 may offloadthe phase detection process to programmer 14. As an example, processor112 of a medical device (e.g., programmer 14, in this case) may receivea first signal generated from a second signal (e.g., receive from IMD16). Processor 112 may correlate the first signal with a frequencycomponent of a frequency band of the second signal. The correlatingincludes predominantly decreasing weighting of past portions of thefirst signal, and predominantly decreasing weighting of past portions ofthe first signal includes predominantly weighting present and morerecent portions of the first signal more heavily than earlier portionsof the first signal, and the frequency band includes one or morefrequency components. Processor 112 may determine a phase of thefrequency component based on a filtered signal outputted from thecorrelation, determine a phase of the frequency band based on thedetermined phase of the frequency component, and instruct a therapymodule (e.g., therapy module 65 of IMD 16) to deliver therapy based onthe determined phase of the frequency band.

In some cases, instead of therapy delivery, programmer 14 may utilizethis determined phase for other purposes such as providing informationfor diagnosing. There may be various uses for the determined phase ofthe frequency band and therapy delivery and diagnosing patient are twoof the various examples. Also, processor 60 may be configured todetermine the phase of the frequency band, and may use this informationto control therapy by therapy module 65 (e.g., instruct therapy module65 to deliver therapy) or output this information for assisting aclinician with diagnosis, or possibly for various other reasons whereknowing the phase of the frequency band is useful.

The following describes some examples comparing the results of real-timephase detection techniques described in this disclosure andnon-real-time phase detection techniques. To test the performance of theEEG theta wave application of this method, sheep EEG data was studied todetermine expected noise characteristics, theta frequency range, anddegree of frequency and amplitude modulation of the theta wave. A morelimited set of human EEG data was also studied. Artificial (andintentionally highly method stressing) EEG waveforms were generated togain insight into the performance. Also, a real sheep EEG waveform stripwith known theta content was tested to validate and supplement thisstudy. In the generated waveforms, the frequency modulations are 2 Hzpeak to peak and have a period of 2 seconds. The center of the modulatedfrequency is swept from 5 hz to 7 hz to 5 hz over a 20 second period.The noise injected is 1/f noise. The signal/noise energy levels are0.5857 with respect to content contained within the non-real-time methodbandpass filter described below.

The non-real-time approach was implemented for comparison purposes. Itwas accomplished by forward and reverse filtering the data with aGaussian windowed bandpass filter, resulting in a Gaussian frequencyresponse centered at 6 hz with a standard deviation of 2.1 Hz and zerodelay. Finally, a Hilbert transform (it/2 phase shift) is applied to thedata to get the imaginary component of the corresponding complex phasor.The real-time phase is calculated from the angle (phase) of the complexphasor. The actual phase in the absence of noise is known in thegenerated EEG data and provides another comparison point. Tables 2 and 3below show the RMS phase error between the real-time method/actualphase, non-real-time method/actual phase, real-time method/non-real-timemethod, and extra RMS phase error resulting from not having access tofuture EEG waveform data (i.e., the real-time penalty). Performance on astrip of real sheep EEG data with known theta content is also providedin the tables.

TABLE 2 RMS error in EEG theta wave phase measurement rms_errorrms_error rms_error (real- rms_error (non- (extra time vs. non-(real-time real-time error for real- real-time) vs. actual) vs. actual)time) 6 hz sine 0.0090*π 0.0090*π 0.0007*π 0.0090*π Only 1/f 0.3511*π NANA NA noise Only swept f 0.0137*π 0.0130*π 0.0019*π 0.0110*π Swept f and0.0651*π 0.0505*π 0.0194*π 0.0311*π FM(4-8 hz) 6 hz sine + 0.1685*π0.2119*π 0.1027*π 0.1092*π 1/f noise Swept FM(4- 0.2063*π 0.2336*π0.1560*π 0.0777*π 8 hz), 6 hz sine + 1/f noise Sheep EEG 0.1279*π NA NANA

TABLE 3 RMS error in EEG theta wave phase measurement updated(Comparison (std. dev. rems error in radians) rms_error rms_errorrms_error (real- rms_error (non- (Diff. time vs. non- (real-timereal-time real-time vs. Simulation real-time) vs. actual) vs. actual)non-real-time) Only 1/f noise  0.36*π 6 Hz sine 0.023*π 0.023*π 0.0007*π0.023*π 6 Hz sine, 0.040*π 0.041*π 0.0061*π 0.035*π AM Sweep & FM0.069*π 0.055*π  0.019*π 0.037*π 6 hz sine +  0.13*π  0.15*π  0.069*π0.084*π 1/f noise AM + 1/f  0.27*π  0.34*π  0.24*π 0.097*π noise Sweep,FM +  0.17*π  0.19*π  0.11*π 0.078*π 1/f noise

FIG. 9 is a graph illustrating a comparison of results between real-timephase detection techniques described in this disclosure andnon-real-time phase detection techniques. FIG. 10 is a graphillustrating another comparison of results between real-time phasedetection techniques described in this disclosure and non-real-timephase detection techniques. FIGS. 9 and 10 show phase estimationperformance for the sheep EEG and row 6 of Table 2, respectively. Thereported phase is shifted by a fixed amount to have π align with thetrough of the theta wave, increasing observability. In FIG. 9, the sheepEEG, row 7 of Table 2 is illustrated, with the plot showing the thetawave phase of sheep EEG determined by real-time and non-real-timemethods. The measured phase determined by the non-real-time method isshown for comparison. In FIG. 10, the theta way phase detection on asimulated EEG trace is illustrated, swept in frequency, frequencymodulated, and with 1/f noise added to the signal to highly stress themethod.

The above examples are for computationally efficient techniques for areal-time phase detector. The techniques utilize a real-time Fouriertransform (RTFT) (e.g., frequency component phase detectors 86A-86C) byutilizing a normal Fourier transform with a predominantly decreasingweighting of the past and zero weighting of the future. Thepredominantly decreasing weighting of the past may be used for itspredictive capability of the present. However, using an asymmetricweighting function (window) may result in non-linear phase delay. Thisis why classical spectral estimation techniques use symmetric windows.The techniques recover from this non-linear phase delay by measuringthis phase delay by modulating the input and output of the weightedFourier transform. The measured phase error is then subtracted from theresult of the weighted Fourier transform. As with a normal Fouriertransform, there is a tradeoff between frequency and time resolution.The potential application space for the developed RTFT concept and otherimplementations of it is considerably more extensive than real-time EEGband phase detection. The EEG band phase detection is provided as oneexample. The techniques also combine multiple RTFTs (e.g., frequencycomponent phase detectors 86A-86C) to form an optimal band shape andcalculate the resulting real-time phase for this optimal band (e.g., viaaverager 88).

Even under extreme noise and modulation conditions (i.e. frequency andamplitude modulation), the real-time performance with respect to thenon-real time method produces a tight distribution with less than a 3%or ˜10° bias and approximately 4% or 15° standard deviation. Thissuggests that the techniques are both robust and accurate under a rangeof conditions.

Furthermore, implementing the example techniques may require only a fewmathematical operations per sample, and given typical implantable device90 nanometer (nm) silicon technology operating at 0.85V, theimplementation of the techniques may consume less than 1 μW of power andcover less than a 500 μm×500 μm area. This estimate assumes 16 bit dataat 250 Hz, using time shared functions, with trigonometric functionsimplemented by a sea-of-gates lookup table. Moreover, this phasedetection method can report the real-time phase at a high data rate(e.g., at the incoming data sampling rate), reducing or effectivelyeliminating latency in computing the real-time phase.

There have been earlier efforts to achieve real-time phase detection,but none have achieved the combination of accuracy and computationalefficiency needed for implantable, wearable, or portable applications.For example, some techniques utilize a powerful algorithm based onautoregression and employed genetic algorithms to search for optimalparameters. The algorithm may require intensive computational power notappropriate for implantable devices with reduced instruction setprocessors, limited memory, and extreme power restrictions. Furthermore,since the band pass filter in this previous approach uses a symmetricwindow, it underweights the most recent, most predictive data. However,the techniques described in this disclosure utilize an asymmetric windowto properly weigh more recent samples.

Some earlier techniques present an adaptive method of frequency trackingthat is used for phase detection and phase-phase coupling. However, suchearlier techniques would not function well for real-time phase detectionand therefore are not specifically optimized for computationalefficiency (i.e., each time step involves many multiplication, addition,and averaging operations). The computational intensity of suchtechniques further increases with extension to multiple-signal tracking.

While the techniques described above are primarily described as beingperformed by processor 60 of IMD 16 or processor 112 of programmer 14,in other examples, one or more other processors may perform any part ofthe techniques described herein alone or in addition to processor 60 orprocessor 112. Thus, reference to “a processor” may refer to “one ormore processors.” Likewise, “one or more processors” may refer to asingle processor or multiple processors in different examples.

The techniques described in this disclosure, including those attributedto IMD 16, programmer 14, or various constituent components, may beimplemented, at least in part, in hardware, software, firmware or anycombination thereof. For example, various aspects of the techniques maybe implemented within one or more processors, including one or moremicroprocessors, DSPs, ASICs, FPGAs, or any other equivalent integratedor discrete logic circuitry, as well as any combinations of suchcomponents, embodied in programmers, such as clinician or patientprogrammers, medical devices, or other devices.

In one or more examples, the functions described in this disclosure maybe implemented in hardware, software, firmware, or any combinationthereof. If implemented in software, the functions may be stored on, asone or more instructions or code, a computer-readable medium andexecuted by a hardware-based processing unit. Computer-readable mediamay include computer-readable storage media forming a tangible,non-transitory medium. Instructions may be executed by one or moreprocessors, such as one or more DSPs, ASICs, FPGAs, general purposemicroprocessors, or other equivalent integrated or discrete logiccircuitry. Accordingly, the term “processor,” as used herein may referto one or more of any of the foregoing structure or any other structuresuitable for implementation of the techniques described herein.

In addition, in some aspects, the functionality described herein may beprovided within dedicated hardware and/or software modules. Depiction ofdifferent features as modules or units is intended to highlightdifferent functional aspects and does not necessarily imply that suchmodules or units must be realized by separate hardware or softwarecomponents. Rather, functionality associated with one or more modules orunits may be performed by separate hardware or software components, orintegrated within common or separate hardware or software components.Also, the techniques could be fully implemented in one or more circuitsor logic elements. The techniques of this disclosure may be implementedin a wide variety of devices or apparatuses, including an IMD, anexternal programmer, a combination of an IMD and external programmer, anintegrated circuit (IC) or a set of ICs, and/or discrete electricalcircuitry, residing in an IMD and/or external programmer.

Various examples have been described. These and other examples arewithin the scope of the following claims.

What is claimed is:
 1. A method comprising: receiving, with circuitry ofa medical device, a first signal, wherein the first signal represents afirst frequency band; determining, with the circuitry, a phase of thefirst signal; receiving, with the circuitry, a second signal, whereinthe second signal represents a second frequency band; determining, withthe circuitry, one or both of a phase of the second signal or anamplitude of the second signal; comparing, with the circuitry, the phaseof the first signal with at least one of the amplitude of the secondsignal or the phase of the second signal in order to generate a thirdsignal; instructing, with the circuitry, a therapy module to delivertherapy based on the third signal; and delivering, with the therapymodule, the therapy.
 2. The method of claim 1, wherein determining oneor both of the phase of the second signal or the amplitude of the secondsignal comprises determining the phase of the second signal, and whereincomparing the phase of the first signal with at least one of theamplitude of the second signal and the phase of the second signalcomprises comparing the phase of the first signal with the phase of thesecond signal in order to generate the third signal.
 3. The method ofclaim 1, wherein determining one or both of the phase of the secondsignal or the amplitude of the second signal comprises determining theamplitude of the second signal, and wherein comparing the phase of thefirst signal with at least one of the amplitude of the second signal andthe phase of the second signal comprises comparing, using a phaseamplitude coupling (PAC) circuit of the circuitry of the medical device,the phase of the first signal with the amplitude of the second signal inorder to generate the third signal.
 4. The method of claim 1, whereinthe first frequency band comprises at least one of a delta frequencyband within a range from 1 Hertz (Hz) to 4 Hz, a theta frequency bandwithin a range from 4 Hz to 8 Hz, an alpha frequency band within a rangefrom 8 Hz to 13 Hz, a beta frequency band within a range from 13 Hz to35 Hz, a gamma frequency band within a range from 35 Hz to 100 Hz, and ahigh gamma frequency band within a range from 100 Hz to 400 Hz, whereinthe second frequency band comprises at least one of the delta frequencyband, the theta frequency band, the alpha frequency band, the betafrequency band, the gamma frequency band, and the high frequency band,and wherein the second frequency band is different than the firstfrequency band.
 5. The method of claim 1, further comprising:determining, based on one or both of the first frequency band and thesecond frequency band, a patient state indicative of an efficacy of thetherapy delivered by the therapy module; and comparing the patient statewith one or more of the phase of the first frequency band, the phase ofthe second frequency band, and the amplitude of the second frequencyband.
 6. The method of claim 1, wherein determining the phase of thefirst signal comprises determining the phase of the first signal inreal-time.
 7. The method of claim 1, wherein determining the phase ofthe second signal comprises determining the phase of the second signalin real-time.
 8. A medical device comprising: circuitry configured to:receive a first signal, wherein the first signal represents a firstfrequency band; determine a phase of the first signal; receiving asecond signal, wherein the second signal represents a second frequencyband; determine one or both of a phase of the second signal or anamplitude of the second signal; compare the phase of the first signalwith at least one of the amplitude of the second signal or the phase ofthe second signal in order to generate a third signal; and instruct atherapy module to deliver therapy based on the third signal; and thetherapy module configured to deliver the therapy.
 9. The medical deviceof claim 8, wherein to determine one or both of the phase of the secondsignal or the amplitude of the second signal, the circuitry isconfigured to determine the phase of the second signal, and wherein tocompare the phase of the first signal with at least one of the amplitudeof the second signal and the phase of the second signal, the circuitryis configured to compare the phase of the first signal with the phase ofthe second signal in order to generate the third signal.
 10. The medicaldevice of claim 8, wherein to determine one or both of the phase of thesecond signal or the amplitude of the second signal, the circuitry isconfigured to determine the amplitude of the second signal, and whereinto compare the phase of the first signal with at least one of theamplitude of the second signal and the phase of the second signal, thecircuitry is configured to compare, using a phase amplitude coupling(PAC) circuit of the circuitry, the phase of the first signal with theamplitude of the second signal in order to generate the third signal.11. The medical device of claim 8, wherein the first frequency bandcomprises at least one of a delta frequency band within a range from 1Hertz (Hz) to 4 Hz, a theta frequency band within a range from 4 Hz to 8Hz, an alpha frequency band within a range from 8 Hz to 13 Hz, a betafrequency band within a range from 13 Hz to 35 Hz, a gamma frequencyband within a range from 35 Hz to 100 Hz, and a high gamma frequencyband within a range from 100 Hz to 400 Hz, wherein the second frequencyband comprises at least one of the delta frequency band, the thetafrequency band, the alpha frequency band, the beta frequency band, thegamma frequency band, and the high frequency band, and wherein thesecond frequency band is different than the first frequency band. 12.The medical device of claim 8, wherein the circuitry is furtherconfigured to: determine, based on one or both of the first frequencyband and the second frequency band, a patient state indicative of anefficacy of the therapy delivered by the therapy module; and compare thepatient state with one or more of the phase of the first frequency band,the phase of the second frequency band, and the amplitude of the secondfrequency band.
 13. The medical device of claim 8, wherein to determinethe phase of the first signal, the circuitry is configured to determinethe phase of the first signal in real-time.
 14. The medical device ofclaim 8, wherein to determine the phase of the second signal, thecircuitry is configured to determine the phase of the second signal inreal-time.
 15. A medical device comprising: circuitry configured to:receive a signal representing a frequency band; correlate the signalwith a first frequency component of the frequency band and a secondfrequency component of the frequency band, wherein correlating thesignal with the set of frequency components causes the circuitry togenerate a first frequency component signal corresponding to the firstfrequency component and a second frequency component signalcorresponding to the second frequency component; determine a phase ofthe first frequency component signal; determine one or both of a phaseof the second frequency component signal or an amplitude of the secondfrequency component signal; compare the phase of the first frequencycomponent signal with at least one of the phase of the second frequencycomponent signal or the amplitude of the second frequency componentsignal in order to generate a comparison signal; and instruct a therapymodule to deliver therapy based on the comparison signal; and thetherapy module configured to deliver the therapy.
 16. The medical deviceof claim 15, wherein to determine one or both of the phase of the secondfrequency component signal or the amplitude of the second frequencycomponent signal, the circuitry is configured to determine the phase ofthe second frequency component signal, and wherein to compare the phaseof the first frequency component signal with at least one of theamplitude of the second frequency component signal and the phase of thesecond frequency component signal, the circuitry is configured tocompare the phase of the first frequency component signal with the phaseof the second frequency component signal in order to generate thecomparison signal.
 17. The medical device of claim 15, wherein todetermine one or both of the phase of the second frequency componentsignal or the amplitude of the second frequency component signal, thecircuitry is configured to determine the amplitude of the secondfrequency component signal, and wherein to compare the phase of thefirst frequency component signal with at least one of the amplitude ofthe second frequency component signal and the phase of the secondfrequency component signal, the circuitry is configured to compare,using a phase amplitude coupling (PAC) circuit of the circuitry, thephase of the first frequency component signal with the amplitude of thesecond frequency component signal in order to generate the comparisonsignal.
 18. The medical device of claim 15, wherein the circuitry isfurther configured to: determine, based on one or both of the firstfrequency component signal and the second frequency component signal, apatient state indicative of an efficacy of the therapy delivered by thetherapy module; and compare the patient state with one or more of thephase of the first frequency component signal, the phase of the secondfrequency component signal, and the amplitude of the second frequencycomponent signal.
 19. The medical device of claim 15, wherein todetermine the phase of the first frequency component signal, thecircuitry is configured to determine the phase of the first frequencycomponent signal in real-time.
 20. The medical device of claim 15,wherein to determine the phase of the second frequency component signal,the circuitry is configured to determine the phase of the secondfrequency component signal in real-time.